Skip to content

Update zh_cn

Update zh_cn #35

Workflow file for this run

name: Build the web book
on:
push:
branches: ["*"]
pull_request:
workflow_dispatch:
inputs:
release:
description: Release this version
type: boolean
default: false
package-index:
description: Package index to publish to
type: choice
options:
- none
- PyPI
# - TestPyPI
permissions:
contents: read
env:
PYPI_PACKAGE: hexdoc-yaha
# adding a branch name here will make hexdoc deploy prerelease versions of your web book on every push to that branch
# for example: https://hexcasting.hexxy.media/v/latest/main/en_us/
HEXDOC_BRANCHES: '["master"]'
jobs:
build-hexdoc:
runs-on: ubuntu-latest
permissions:
contents: read
pages: read
outputs:
pages-url: ${{ steps.build.outputs.pages-url }}
deploy: ${{ github.event_name != 'pull_request' && contains(fromJson(env.HEXDOC_BRANCHES), github.ref_name) || inputs.release == true }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version-file: .python-version
- uses: astral-sh/setup-uv@v6
with:
activate-environment: true
enable-cache: true
- name: Sync dependencies
run: uv sync --frozen --no-dev
- id: build
uses: hexdoc-dev/actions/build@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release: ${{ inputs.release == true }}
deploy-pages:
needs: build-hexdoc
if: needs.build-hexdoc.outputs.deploy == 'true'
runs-on: ubuntu-latest
concurrency:
group: hexdoc-deploy-pages
cancel-in-progress: false
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version-file: .python-version
- uses: astral-sh/setup-uv@v6
with:
activate-environment: true
enable-cache: true
- name: Sync dependencies
run: uv sync --frozen --no-dev
- name: Merge new hexdoc build into existing book
uses: hexdoc-dev/actions/merge@v1
with:
release: ${{ inputs.release == true }}
site-url: ${{ needs.build-hexdoc.outputs.pages-url }}
# if you want to add extra things to your website (eg. Javadoc/Dokka), add it to _site/dst/docs here
- name: Deploy to Pages
uses: hexdoc-dev/actions/deploy-pages@v1
with:
release: ${{ inputs.release == true }}
merge: false
publish-pypi:
runs-on: ubuntu-latest
needs:
- build-hexdoc
- deploy-pages
if: inputs.release == true && inputs.package-index == 'PyPI'
environment:
name: pypi
url: https://pypi.org/p/${{ env.PYPI_PACKAGE }}
permissions:
id-token: write
steps:
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: hexdoc-build
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# Uncomment if you want to try publishing to TestPyPI before using the real index.
# publish-testpypi:
# runs-on: ubuntu-latest
# needs:
# - build-hexdoc
# - deploy-pages
# if: inputs.package-index == 'TestPyPI'
# environment:
# name: testpypi
# url: https://test.pypi.org/p/${{ env.PYPI_PACKAGE }}
# permissions:
# id-token: write
# steps:
# - name: Download package artifact
# uses: actions/download-artifact@v4
# with:
# name: hexdoc-build
# path: dist
# - name: Publish to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/