docs: replace custom GitHub Action with CI workflow guide #43
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: Documentation | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'docs/**' | |
| - 'mkdocs.yml' | |
| - 'headerkit/**' | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to deploy (e.g., 0.3)' | |
| required: true | |
| set_latest: | |
| description: 'Set as latest?' | |
| type: boolean | |
| default: true | |
| concurrency: | |
| group: docs-deploy | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: pip install -e '.[docs]' | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Extract version from tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| id: version | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/v}" | |
| MINOR="${TAG%.*}" | |
| echo "version=$MINOR" >> "$GITHUB_OUTPUT" | |
| echo "Deploying docs for version: $MINOR" | |
| - name: Deploy versioned docs (tag push) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| mike deploy --push --update-aliases "${{ steps.version.outputs.version }}" latest | |
| - name: Set default version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: mike set-default --push latest | |
| - name: Deploy dev docs (main push) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| mike deploy --push dev | |
| - name: Deploy versioned docs (manual) | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| if [ "${{ inputs.set_latest }}" = "true" ]; then | |
| mike deploy --push --update-aliases "${{ inputs.version }}" latest | |
| else | |
| mike deploy --push "${{ inputs.version }}" | |
| fi |