chore(deps): update actions/cache action to v6 #561
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: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-wheel: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Build wheel | |
| run: uv build --wheel | |
| - name: Upload wheel | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: dist-wheel | |
| path: dist/*.whl | |
| if-no-files-found: error | |
| build-sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Build source distribution | |
| run: uv build --sdist | |
| - name: Upload source distribution | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: dist-sdist | |
| path: dist/*.tar.gz | |
| if-no-files-found: error | |
| lint-dist: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-wheel | |
| - build-sdist | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Download distributions | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: dist-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Verify wheel install | |
| run: | | |
| uv venv .venv-install-whl | |
| source .venv-install-whl/bin/activate | |
| uv pip install dist/*.whl | |
| - name: Verify source install | |
| run: | | |
| uv venv .venv-install-tar | |
| source .venv-install-tar/bin/activate | |
| uv pip install dist/*.tar.gz | |
| - name: Check package metadata | |
| run: uvx twine check dist/* | |
| - name: Check distribution contents | |
| run: uvx pydistcheck --inspect dist/* | |
| - name: Check source metadata | |
| run: uvx pyroma dist/*.tar.gz | |
| - name: Check wheel contents | |
| run: uvx check-wheel-contents dist/*.whl | |
| - name: Check source manifest | |
| run: uvx check-manifest -v | |
| publish-pypi: | |
| runs-on: ubuntu-latest | |
| needs: lint-dist | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Download distributions | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: dist-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish to PyPI | |
| run: uv publish --trusted-publishing always | |
| publish-github-release: | |
| runs-on: ubuntu-latest | |
| needs: lint-dist | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Download distributions | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: dist-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Extract release notes | |
| env: | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: | | |
| version="${TAG_NAME#v}" | |
| awk -v version="$version" ' | |
| index($0, "## [" version "]") == 1 { in_section = 1; next } | |
| in_section && /^## / { exit } | |
| in_section { print } | |
| ' CHANGELOG.md > release-notes.md | |
| sed -i '1{/^$/d;}' release-notes.md | |
| if ! grep -q '[^[:space:]]' release-notes.md; then | |
| echo "No CHANGELOG.md section found for ${version}" >&2 | |
| exit 1 | |
| fi | |
| - name: Update GitHub release notes | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: gh release edit "$TAG_NAME" --notes-file release-notes.md | |
| - name: Upload GitHub release assets | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: gh release upload "$TAG_NAME" dist/*.whl dist/*.tar.gz --clobber |