From ef3762f7675da7df5ce8dcbc011b4aa56ca2b701 Mon Sep 17 00:00:00 2001 From: Francesco Capuano Date: Wed, 13 May 2026 14:45:07 +0200 Subject: [PATCH] Add PyPI release workflow triggered on version tag Tag-driven release: pushing a v* tag verifies it matches the pyproject.toml version, builds with uv, and publishes via OIDC trusted publishing through a `pypi` GitHub environment. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e9fb3af9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: Publish to PyPI + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: Verify tag matches pyproject.toml version + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + PROJECT_VERSION=$(grep -m1 '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/') + if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then + echo "Tag v$TAG_VERSION does not match pyproject.toml version $PROJECT_VERSION" + exit 1 + fi + echo "Version check passed: $PROJECT_VERSION" + + - name: Build sdist and wheel + run: uv build + + - name: Upload distribution artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish: + name: Publish to PyPI + needs: build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/orca_core + permissions: + id-token: write + steps: + - name: Download distribution artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1