Repository navigation
chore(deps): bump filelock from 3.32.7 to 4.2.1 #39
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 | |
| on: | |
| push: | |
| tags: ['v*'] | |
| # Packaging check for every PR targeting the release branch: build the | |
| # sdist/wheel and publish to TestPyPI before a release tag is cut. Each PR | |
| # run rewrites the version to <base>.dev<run number> so every push publishes | |
| # a distinct artifact (a fixed version would be skipped after the first | |
| # upload). Tag pushes publish the committed version unchanged. | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: astral-sh/setup-uv@v10.1.0 | |
| with: | |
| python-version: '3.11' | |
| - name: Verify tag matches package version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| set -euo pipefail | |
| ver=$(python3 -c "import sys; sys.path.insert(0, 'utils'); import check_version_sync as c; print(c.config_version())") | |
| tag="${GITHUB_REF_NAME#v}" | |
| if [ "$tag" != "$ver" ]; then | |
| echo "::error::Tag ${GITHUB_REF_NAME} does not match package version ${ver}" | |
| exit 1 | |
| fi | |
| echo "Tag ${GITHUB_REF_NAME} matches package version ${ver}" | |
| # TestPyPI only: give this PR run a unique developmental version so | |
| # repeated pushes produce new artifacts instead of being skipped. The | |
| # committed sources on the runner are rewritten, never committed. A | |
| # commit-hash suffix is impossible here (PEP 440 forbids local version | |
| # identifiers on PyPI), so the SHA goes to the run summary instead. | |
| - name: Set TestPyPI dev version | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| set -euo pipefail | |
| base="$(uv version --short)" | |
| dev="${base}.dev${{ github.run_number }}" | |
| python utils/set_dev_version.py "$dev" | |
| { | |
| echo "### TestPyPI pre-publish" | |
| echo "" | |
| echo "- version: \`${dev}\`" | |
| echo "- commit: \`${{ github.sha }}\`" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Build distributions | |
| run: uv build | |
| - name: Upload dist | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish-testpypi: | |
| needs: build | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download dist | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to TestPyPI (Trusted Publishing / OIDC) | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| # No `password`: uses OIDC Trusted Publishing configured on | |
| # TestPyPI for the pull_request subject claim. | |
| # Each run carries a unique .dev<run number> version, so this is a | |
| # safety net rather than a workaround: TestPyPI rejects re-uploads | |
| # of existing files, and a collision should stay green (not fail). | |
| skip-existing: true | |
| publish-pypi: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Needed for the GitHub Release step, which extracts the release notes | |
| # from CHANGELOG.md. | |
| - uses: actions/checkout@v7 | |
| - name: Download dist | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI (Trusted Publishing / OIDC) | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # No `password`: uses OIDC Trusted Publishing (configured once on PyPI). | |
| # Fallback if not using Trusted Publishing: set the PYPI_API_TOKEN | |
| # secret and uncomment the `with` block below. | |
| # with: | |
| # password: ${{ secrets.PYPI_API_TOKEN }} | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| ver="${GITHUB_REF_NAME#v}" | |
| awk -v v="$ver" ' | |
| index($0, "## [" v "]") == 1 {insec=1; next} | |
| /^## / && insec {exit} | |
| insec {print} | |
| ' CHANGELOG.md > release_notes.md | |
| gh release create "${GITHUB_REF_NAME}" --title "${GITHUB_REF_NAME}" \ | |
| --notes-file release_notes.md dist/* |