Correct a grammar error #232
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
| # Build and Deploy Docs - Testing GitHub Actions | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| concurrency: | |
| group: docs-build-deploy | |
| cancel-in-progress: false | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| langs_json: ${{ steps.langs.outputs.json }} | |
| steps: | |
| - name: Define document languages | |
| id: langs | |
| run: | | |
| echo 'json=["en","de","es","fr","it","jp","pl"]' >> "$GITHUB_OUTPUT" | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lang: ${{ fromJSON(needs.prepare.outputs.langs_json) }} | |
| steps: | |
| - name: Checkout docs4.x | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10.4" | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: Build ${{ matrix.lang }} | |
| working-directory: docs/${{ matrix.lang }} | |
| run: mkdocs build --site-dir ../../site/${{ matrix.lang }} | |
| - name: Upload ${{ matrix.lang }} artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: site-${{ matrix.lang }} | |
| path: site/${{ matrix.lang }} | |
| if-no-files-found: error | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - prepare | |
| - build | |
| steps: | |
| - name: Download built site artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: site-* | |
| path: site | |
| - name: Checkout docs-build | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: gl-inet/docs-build | |
| ssh-key: ${{ secrets.DEPLOY_KEY }} | |
| path: docs-build | |
| clean: true | |
| fetch-depth: 0 | |
| - name: Deploy built docs to docs-build | |
| run: | | |
| for lang in ${{ join(fromJSON(needs.prepare.outputs.langs_json), ' ') }}; do | |
| rm -rf docs-build/router/$lang/4 | |
| mkdir -p docs-build/router/$lang/4 | |
| cp -r site/site-$lang/. docs-build/router/$lang/4/ | |
| done | |
| - name: Commit and Push to docs-build | |
| working-directory: ./docs-build | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| if [ -n "$(git diff --cached --name-only)" ]; then | |
| git commit -m "docs4 build: $(git log -1 --format='%H')" | |
| git pull --rebase origin master | |
| git push | |
| echo "✅ Deployed successfully" | |
| else | |
| echo "ℹ️ No changes to deploy" | |
| fi |