fix: polish bilingual docs and alert rendering #169
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
| name: GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| env: | |
| main_branch: main | |
| base_url: 'https://openmower.de/' | |
| permissions: | |
| contents: write | |
| # Ensure only one deployment runs at a time, but don't cancel older ones | |
| concurrency: | |
| group: gh-pages | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive # Fetch the Docsy theme | |
| fetch-depth: 0 | |
| # Workaround for actions/checkout dropping tag annotations on tag runs | |
| - name: Restore annotated tags | |
| run: | | |
| # Overwrite local tag refs with real tag objects from origin | |
| git fetch --force origin 'refs/tags/*:refs/tags/*' | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@v2 | |
| with: | |
| hugo-version: '0.111.3' | |
| extended: true | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Check automatic language selection | |
| run: node scripts/check-language-preference.cjs | |
| - run: npm install | |
| - run: scripts/gen-doc-versions.sh | |
| # Build for main (full site, version "latest", baseURL /latest/) | |
| - name: Build Hugo (main) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| cat > config/_ci_override.toml << EOF | |
| baseURL = "${{ env.base_url }}latest/" | |
| [params] | |
| version = "latest" | |
| EOF | |
| hugo --minify --config config.toml,config/_generated_versions.toml,config/_ci_override.toml | |
| # Build for tags (docs-only environment, version = tag, baseURL /archive/<tag>/) | |
| - name: Build Hugo (tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| cat > config/_ci_override.toml << EOF | |
| baseURL = "${{ env.base_url }}archive/${{ github.ref_name }}/" | |
| [params] | |
| version = "${{ github.ref_name }}" | |
| archived_version = true | |
| EOF | |
| hugo --minify --environment docs-only --config config.toml,config/_generated_versions.toml,config/_ci_override.toml | |
| - name: Prepare root files and historical redirects | |
| if: github.ref == 'refs/heads/main' | |
| run: python3 scripts/prepare-pages.py --origin "${{ env.base_url }}" | |
| - name: Check translation coverage and technical examples | |
| if: github.ref == 'refs/heads/main' | |
| run: python3 scripts/check-translations.py | |
| - name: Check generated pages and historical redirects | |
| if: github.ref == 'refs/heads/main' | |
| run: python3 scripts/check-pages.py --origin "${{ env.base_url }}" | |
| # Deploy main build to /latest | |
| - name: Deploy latest (main) | |
| if: github.ref == 'refs/heads/main' | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./public | |
| destination_dir: latest | |
| # Deploy tag builds to /archive/<tag> | |
| - name: Deploy archive (tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./public | |
| destination_dir: archive/${{ github.ref_name }} | |
| # Deploy root index and CNAME, keeping /latest and /archive/* | |
| - name: Deploy root index and CNAME | |
| if: github.ref == 'refs/heads/main' | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./public-root | |
| keep_files: true | |
| cname: openmower.de |