mirror of
https://github.com/usestrix/strix.git
synced 2026-09-14 23:21:15 +00:00
ci: publish package to PyPI on release tags
This commit is contained in:
parent
8551339130
commit
ad16408d5f
1 changed files with 33 additions and 0 deletions
33
.github/workflows/build-release.yml
vendored
33
.github/workflows/build-release.yml
vendored
|
|
@ -119,3 +119,36 @@ jobs:
|
|||
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
generate_release_notes: true
|
||||
files: release/**
|
||||
|
||||
publish-pypi:
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
|
||||
|
||||
- name: Verify tag matches package version
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION="$(uv run python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
|
||||
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
||||
if [[ "${TAG_VERSION}" != "${VERSION}" ]]; then
|
||||
echo "::error::Tag ${GITHUB_REF_NAME} does not match pyproject.toml version ${VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build Python distribution
|
||||
shell: bash
|
||||
run: uv build
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue