release #59
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: release | |
| on: | |
| push: | |
| tags: ["v*.*.*"] | |
| workflow_run: | |
| workflows: ["bump version"] | |
| types: ["completed"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| update-stable: | |
| runs-on: ubuntu-latest | |
| if: ${{ (github.event_name == 'push' && github.ref_type == 'tag') || github.event_name == 'workflow_run' }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: update stable branch pointer | |
| run: | | |
| echo "updating stable branch pointer to point to main" | |
| git fetch origin | |
| git branch -f stable HEAD | |
| git push origin stable --force | |
| echo "stable now points to: $(git rev-parse HEAD)" | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: update-stable | |
| if: ${{ (github.event_name == 'push' && github.ref_type == 'tag') || github.event_name == 'workflow_run' }} | |
| steps: | |
| - name: (debug) print workflow trigger | |
| run: | | |
| echo "triggered by: ${{ github.event_name }}" | |
| echo "workflow run conclusion: ${{ github.event.workflow_run.conclusion }}" | |
| echo "head commit message: ${{ github.event.head_commit.message }}" | |
| echo "ref: ${{ github.ref }}" | |
| echo "ref_name: ${{ github.ref_name }}" | |
| echo "ref_type: ${{ github.ref_type }}" | |
| echo "sha: ${{ github.sha }}" | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: update lockfile | |
| run: uv lock | |
| - name: install build deps & build | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| python -m build | |
| - name: upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: ${{ (github.event_name == 'push' && github.ref_type == 'tag') || github.event_name == 'workflow_run' }} | |
| steps: | |
| - name: download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # run: echo "publishing to PyPI... (skipped in this edit)" |