From 0382c4e3024c96809ffd89dd76d820efcd56479d Mon Sep 17 00:00:00 2001 From: Pratik Bhadane Date: Tue, 24 Mar 2026 03:00:06 +0530 Subject: [PATCH] ci: add release.yml to auto-publish on version tag push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pushing v* tag now triggers: 1. release.yml — creates a GitHub Release (published, not draft), pulling the release notes from CHANGELOG.md automatically. 2. CI.yml (release: published event) — builds wheels for Linux / macOS / Windows × Python 3.10-3.13, sdist, publishes to PyPI via trusted publisher, publishes ferro_ta_core to crates.io, and generates SBOMs. Pre-release tags (e.g. v1.1.0-rc.1) are marked as pre-release on GitHub automatically. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 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 0000000..91b10b4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release + +# Triggered when a version tag is pushed (e.g. v1.0.2). +# Creates a GitHub Release marked as "published", which in turn +# triggers the build-wheels and publish jobs in CI.yml. + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +permissions: + contents: write + +jobs: + create-release: + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Extract version from tag + id: version + run: | + VERSION="${GITHUB_REF_NAME#v}" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Extract changelog entry for this version + id: changelog + env: + TAG_NAME: ${{ github.ref_name }} + run: | + python3 - <<'PY' + import re, os, pathlib + + version = os.environ["TAG_NAME"].lstrip("v") + text = pathlib.Path("CHANGELOG.md").read_text(encoding="utf-8") + + pattern = rf"## \[{re.escape(version)}\].*?\n(.*?)(?=\n## |\Z)" + match = re.search(pattern, text, re.DOTALL) + body = match.group(1).strip() if match else f"Release {version}" + + with open(os.environ["GITHUB_OUTPUT"], "a") as f: + f.write(f"body<