Merge branch 'develop' of https://github.com/eea/CLMS_documents into … #238
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: Deploy Documentation | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - test | |
| - main | |
| workflow_dispatch: # Allow manual triggers from GitHub UI | |
| jobs: | |
| deploy_docs: | |
| name: Build and Deploy Docs [${{ github.ref_name }}] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: mckeea/quarto-doc-builder:latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Mark repo as safe for Git | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Show commit history | |
| run: git log --oneline -n 5 | |
| - name: Get changed .qmd files on current branch | |
| run: | | |
| (git diff --name-only HEAD^ HEAD | grep -E '\.qmd$' || true) > modified_docs_list.txt | |
| echo "Modified .qmd files:" | |
| cat modified_docs_list.txt | |
| - name: Generate intros and keywords | |
| uses: addnab/docker-run-action@v3 | |
| with: | |
| image: mckeea/llm-doc-annotator:latest | |
| options: -e GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }} -v ${{ github.workspace }}:/app | |
| run: python .github/scripts/generate_intros_and_keywords.py modified_docs_list.txt | |
| - name: Set up git user for commits | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| - name: Detect test mode for dry-run | |
| id: test_mode | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/heads/test-* ]]; then | |
| echo "dry_run=true" >> $GITHUB_OUTPUT | |
| echo "🔍 Test branch detected - enabling DRY_RUN mode" | |
| else | |
| echo "dry_run=false" >> $GITHUB_OUTPUT | |
| echo "✅ Production branch - normal execution" | |
| fi | |
| - name: Update versions and changelogs (test/main only) | |
| if: github.ref_name == 'test' || github.ref_name == 'main' || startsWith(github.ref, 'refs/heads/test-') | |
| uses: addnab/docker-run-action@v3 | |
| with: | |
| image: mckeea/llm-doc-annotator:latest | |
| options: -e GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }} -e DRY_RUN=${{ steps.test_mode.outputs.dry_run }} -v ${{ github.workspace }}:/app | |
| run: | | |
| git config --global --add safe.directory /app | |
| python .github/scripts/update_versions_and_changelogs.py | |
| - name: Commit updated LLM cache and version history | |
| if: steps.test_mode.outputs.dry_run == 'false' | |
| run: | | |
| git add .llm_cache .version-history | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "Update LLM cache and version history [skip ci]" | |
| git push origin HEAD | |
| fi | |
| - name: Build Docs | |
| run: .github/scripts/build-docs.sh | |
| env: | |
| SKIP_DOCX: ${{ github.ref_name != 'develop' && '1' || '' }} | |
| - name: Commit updated non-browsable doc map | |
| run: | | |
| git add .github/non_browsable_doc_map.json | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "Update non-browsable doc map [skip ci]" | |
| git push origin HEAD | |
| fi | |
| - name: Deploy to GitHub Pages | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: DOCS/_site | |
| target-folder: ${{ github.ref_name }} | |
| clean: true | |
| token: ${{ secrets.GITHUB_TOKEN }} |