Mkdocs to GH-Pages #11
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: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy-docs: | |
| name: Deploy Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name github-actions[bot] | |
| git config user.email github-actions[bot]@users.noreply.github.com | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Install dependencies | |
| run: | | |
| pip install mkdocs-material mike | |
| - name: Generate changelog for main | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| chmod +x .github/scripts/generate-changelog.sh | |
| .github/scripts/generate-changelog.sh docs/changelog/main.md | |
| - name: Deploy main version (main) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| mike deploy --push --update-aliases main latest | |
| - name: Generate changelog for tagged version | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| chmod +x .github/scripts/generate-changelog.sh | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG_NAME#v} | |
| .github/scripts/generate-changelog.sh "docs/changelog/$VERSION.md" "$TAG_NAME" | |
| - name: Deploy tagged version | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG_NAME#v} | |
| # Check if this is a pre-release (contains -, alpha, beta, rc) | |
| if [[ "$VERSION" =~ - ]]; then | |
| echo "Deploying pre-release version: $VERSION" | |
| mike deploy --push "$VERSION" | |
| else | |
| echo "Deploying stable version: $VERSION" | |
| mike deploy --push --update-aliases "$VERSION" stable | |
| mike set-default --push stable | |
| fi |