feat(workflow): add workflow name state management #100
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 Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' # Trigger on version tags like v0.5.0, v0.6.0 | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Important for mike to read history | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v1 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Configure Git user | |
| run: | | |
| git config --global user.name "GitHub Action" | |
| git config --global user.email "[email protected]" | |
| - name: Deploy documentation | |
| run: | | |
| if [[ $GITHUB_REF == 'refs/heads/main' ]]; then | |
| uv run mike deploy dev --push | |
| elif [[ $GITHUB_REF == refs/tags/* ]]; then | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| uv run mike deploy $TAG_NAME latest --update-aliases --push | |
| uv run mike set-default latest --push | |
| # Add CNAME file for custom domain | |
| git checkout gh-pages | |
| echo "docs.codemachine.co" > CNAME | |
| git add CNAME | |
| git commit -m "Add CNAME for custom domain" || true | |
| git push origin gh-pages | |
| fi |