fix(ci): Use python -m build instead of uv build for semantic-release #20
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: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| secrets: inherit | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| environment: PyPi | |
| outputs: | |
| released: ${{ steps.release.outputs.released }} | |
| tag: ${{ steps.release.outputs.tag }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Generate token for version incrementer app | |
| id: create_token | |
| uses: tibdex/github-app-token@v2 | |
| with: | |
| app_id: ${{ secrets.APP_ID }} | |
| private_key: ${{ secrets.PRIVATE_KEY }} | |
| - name: Setup | Checkout Repository on Release Branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| token: ${{ steps.create_token.outputs.token }} | |
| - name: Sync to latest remote | |
| run: | | |
| git fetch --prune origin | |
| git checkout ${{ github.ref_name }} | |
| git merge --ff-only origin/${{ github.ref_name }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| - name: Action | Semantic Version Release | |
| id: release | |
| uses: python-semantic-release/python-semantic-release@v10.4.1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| git_committer_name: "github-actions" | |
| git_committer_email: "actions@users.noreply.github.com" | |
| commit: "false" | |
| push: "false" | |
| tag: "false" | |
| changelog: "true" | |
| vcs_release: "false" | |
| - name: Commit and push version changes | |
| if: steps.release.outputs.released == 'true' | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "actions@users.noreply.github.com" | |
| uv lock | |
| git add pyproject.toml CHANGELOG.md uv.lock | |
| git commit -m "${{ steps.release.outputs.tag }} | |
| Automatically generated by python-semantic-release" | |
| git tag ${{ steps.release.outputs.tag }} | |
| git push origin ${{ github.ref_name }} --tags | |
| - name: Create GitHub Release | |
| if: steps.release.outputs.released == 'true' | |
| run: | | |
| gh release create ${{ steps.release.outputs.tag }} \ | |
| --title "${{ steps.release.outputs.tag }}" \ | |
| --generate-notes | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish | Upload to GitHub Release Assets | |
| uses: python-semantic-release/publish-action@v10.4.1 | |
| if: steps.release.outputs.released == 'true' | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ steps.release.outputs.tag }} | |
| - name: Upload | Distribution Artifacts | |
| if: steps.release.outputs.released == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: distribution-artifacts | |
| path: dist | |
| if-no-files-found: error | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: PyPi | |
| needs: release | |
| if: ${{ needs.release.outputs.released == 'true' }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Setup | Download Build Artifacts | |
| uses: actions/download-artifact@v4 | |
| id: artifact-download | |
| with: | |
| name: distribution-artifacts | |
| path: dist | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ |