chore: templates generated by RadxaOS-SDK/rsdk@58ec0e70bf109cab45363a… #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| concurrency: | |
| cancel-in-progress: true | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| jobs: | |
| build-doc: | |
| permissions: | |
| id-token: "write" | |
| pages: "write" | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - name: "Checkout" | |
| uses: "actions/checkout@v5" | |
| with: | |
| fetch-depth: 0 | |
| - name: "Install Nix" | |
| uses: "cachix/install-nix-action@v26" | |
| - name: "Use cachix" | |
| uses: "cachix/cachix-action@v14" | |
| with: | |
| name: "devenv" | |
| - name: "Install devenv.sh" | |
| run: "nix profile install nixpkgs#devenv" | |
| - name: "Build" | |
| run: | | |
| devenv shell mdbook build | |
| for po_lang in zh-CN | |
| do | |
| POT_CREATION_DATE=$(grep --max-count 1 '^"POT-Creation-Date:' po/$po_lang.po | sed -E 's/".*: (.*)\\n"/\1/') | |
| if [[ $POT_CREATION_DATE == "" ]]; then | |
| POT_CREATION_DATE=now | |
| fi | |
| echo "::group::Building $po_lang translation as of $POT_CREATION_DATE" | |
| rm -r docs/ | |
| git restore --source "$(git rev-list -n 1 --before "$POT_CREATION_DATE" @)" docs/ | |
| # Set language and adjust site URL. Clear the redirects | |
| # since they are in sync with the source files, not the | |
| # translation. | |
| MDBOOK_BOOK__LANGUAGE=$po_lang \ | |
| MDBOOK_OUTPUT__HTML__SITE_URL=/radxa-overlays/$po_lang/ \ | |
| MDBOOK_OUTPUT__HTML__REDIRECT='{}' \ | |
| devenv shell mdbook build -d book/$po_lang | |
| mv book/$po_lang/html book/html/$po_lang | |
| echo "::endgroup::" | |
| done | |
| shell: "bash" | |
| - name: "Setup Pages" | |
| uses: "actions/configure-pages@v5" | |
| - name: "Upload artifact" | |
| uses: "actions/upload-pages-artifact@v4" | |
| with: | |
| path: "./book/html" | |
| - if: "github.event_name != 'pull_request'" | |
| name: "Deploy to GitHub Pages" | |
| uses: "actions/deploy-pages@v4" | |
| name: "Deploy documentation" | |
| "on": | |
| merge_group: {} | |
| pull_request: | |
| paths: | |
| - "docs/**" | |
| - "theme/**" | |
| - "po/**" | |
| - "book.toml" | |
| - ".github/workflows/docs.yaml" | |
| push: | |
| branches: | |
| - "main" | |
| paths: | |
| - "docs/**" | |
| - "theme/**" | |
| - "po/**" | |
| - "book.toml" | |
| - ".github/workflows/docs.yaml" | |
| workflow_dispatch: {} | |
| permissions: {} |