Support file based configs #15
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 | |
| # Build changelog index page so /changelog/ is a valid route | |
| mkdir -p docs/changelog | |
| { | |
| echo "# Changelog" | |
| echo | |
| echo "This section lists version-specific changelogs." | |
| echo | |
| } > docs/changelog/index.md | |
| for f in docs/changelog/*.md; do | |
| [ -f "$f" ] || continue | |
| base=$(basename "$f" .md) | |
| [ "$base" = "index" ] && continue | |
| if [ "$base" = "main" ]; then | |
| title="Unreleased (main)" | |
| else | |
| title="Version $base" | |
| fi | |
| echo "- [$title](./$base/)" >> docs/changelog/index.md | |
| done | |
| - 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" | |
| # Build changelog index page so /changelog/ is a valid route | |
| mkdir -p docs/changelog | |
| { | |
| echo "# Changelog" | |
| echo | |
| echo "This section lists version-specific changelogs." | |
| echo | |
| } > docs/changelog/index.md | |
| for f in docs/changelog/*.md; do | |
| [ -f "$f" ] || continue | |
| base=$(basename "$f" .md) | |
| [ "$base" = "index" ] && continue | |
| if [ "$base" = "main" ]; then | |
| title="Unreleased (main)" | |
| else | |
| title="Version $base" | |
| fi | |
| echo "- [$title](./$base/)" >> docs/changelog/index.md | |
| done | |
| - 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 |