Update examples #6
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: Publish MkDocs Documentation | |
| on: | |
| push: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 # Required for mike to work properly | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Update Assets | |
| run: git submodule update --remote --recursive docs/documentation-assets | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install \ | |
| mkdocs-material \ | |
| mkdocs-macros-plugin \ | |
| mkdocs-monorepo-plugin \ | |
| mkdocs-site-urls \ | |
| mkdocs-caption \ | |
| markdown-tables-extended \ | |
| mkdocs-minify-plugin | |
| - name: Get Git Info | |
| id: git-info | |
| run: | | |
| BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
| HASH=$(git rev-parse --short HEAD) | |
| echo "GIT_INFO=${BRANCH}:${HASH}" >> $GITHUB_OUTPUT | |
| echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| echo "CURRENT_YEAR=$(date +'%Y')" >> $GITHUB_OUTPUT | |
| - name: Substitute env variables in mkdocs.yml | |
| env: | |
| GIT_INFO: ${{ steps.git-info.outputs.GIT_INFO }} | |
| BUILD_DATE: ${{ steps.git-info.outputs.DATE }} | |
| CURRENT_YEAR: ${{ steps.git-info.outputs.CURRENT_YEAR }} | |
| run: | | |
| # Create backup | |
| cp mkdocs.yml mkdocs.yml.bak | |
| # Substitute variables | |
| envsubst '$BUILD_DATE $GIT_INFO $CURRENT_YEAR' < mkdocs.yml.bak > mkdocs.yml | |
| # Display substituted content for debugging | |
| echo "--- Checking substituted content ---" | |
| cat mkdocs.yml | grep -A5 copyright | |
| - name: Deploy documentation | |
| run: | | |
| mkdocs build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './site' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |