Spaces:
Sleeping
Sleeping
| name: release-main | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| semantic-release: | |
| runs-on: ubuntu-latest | |
| concurrency: release | |
| permissions: | |
| id-token: write | |
| contents: write | |
| outputs: | |
| released: ${{ steps.release.outputs.released }} | |
| tag: ${{ steps.release.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup | Force release branch to be at workflow sha | |
| run: | | |
| git reset --hard ${{ github.sha }} | |
| - name: Action | Python Semantic Release | |
| id: release | |
| uses: python-semantic-release/python-semantic-release@v9.21.1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| # The following is done through the on-release-main.yml action. | |
| # Leaving this here for reference. | |
| # - name: Publish | Upload package to PyPI | |
| # uses: pypa/gh-action-pypi-publish@release/v1 | |
| # # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. | |
| # # See https://github.com/actions/runner/issues/1173 | |
| # if: steps.release.outputs.released == 'true' | |
| - name: Publish | Upload to GitHub Release Assets | |
| uses: python-semantic-release/publish-action@v9.21.1 | |
| if: steps.release.outputs.released == 'true' | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ steps.release.outputs.tag }} | |
| set-version: | |
| needs: [semantic-release] | |
| if: needs.semantic-release.outputs.released == 'true' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Update project version | |
| run: | | |
| sed -i "s/^version = \".*\"/version = \"$RELEASE_VERSION\"/" pyproject.toml | |
| env: | |
| RELEASE_VERSION: ${{ needs.semantic-release.outputs.tag }} | |
| - name: Upload updated pyproject.toml | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyproject-toml | |
| path: pyproject.toml | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: [set-version] | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| - name: Set up the environment | |
| uses: ./.github/actions/setup-python-env | |
| - name: Download updated pyproject.toml | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pyproject-toml | |
| - name: Build package | |
| run: uv build | |
| - name: Publish package | |
| run: uv publish | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| deploy-docs: | |
| needs: publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| - name: Set up the environment | |
| uses: ./.github/actions/setup-python-env | |
| - name: Deploy documentation | |
| run: uv run mkdocs gh-deploy --force | |