Skip to content

Commit cabb9b3

Browse files
committed
ci: publish to PyPI from release tags
release-gate now builds and publishes via trusted publishing (OIDC) when a v* tag is pushed; verifies the tag matches pyproject version first.
1 parent 6e7d494 commit cabb9b3

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,38 @@ jobs:
109109
echo "Isolated install smoke test passed."
110110
111111
release-gate:
112+
if: startsWith(github.ref, 'refs/tags/v')
112113
needs: [test-and-build, s3-integration, isolated-install-smoke]
113114
runs-on: ubuntu-latest
115+
permissions:
116+
id-token: write # OIDC -> PyPI trusted publishing (no API token)
117+
contents: read
118+
114119
steps:
115-
- run: echo "All release gates passed."
120+
- name: Check out repository
121+
uses: actions/checkout@v4
122+
123+
- name: Set up Python
124+
uses: actions/setup-python@v5
125+
with:
126+
python-version: "3.12"
127+
128+
- name: Set up uv
129+
uses: astral-sh/setup-uv@v4
130+
131+
- name: Verify tag matches package version
132+
run: |
133+
set -euo pipefail
134+
TAG_VERSION="${GITHUB_REF_NAME#v}"
135+
PACKAGE_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml)"
136+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
137+
echo "Tag ${GITHUB_REF_NAME} does not match pyproject version ${PACKAGE_VERSION}" >&2
138+
exit 1
139+
fi
140+
echo "Releasing dataref ${PACKAGE_VERSION}"
141+
142+
- name: Build package
143+
run: uv build
144+
145+
- name: Publish to PyPI
146+
run: uv publish --publish-url https://upload.pypi.org/legacy/ --check-url https://pypi.org/pypi/dataref/json

0 commit comments

Comments
 (0)