Skip to content

feat: git branch awareness - scoped re-index + ledger/session/snapsho… #11

feat: git branch awareness - scoped re-index + ledger/session/snapsho…

feat: git branch awareness - scoped re-index + ledger/session/snapsho… #11

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
# Required for PyPI Trusted Publishing (OIDC):
# 1. On PyPI, go to the project page → Publishing → Add a pending publisher.
# 2. Owner = drknowhow, Repository = code-context-control,
# Workflow = release.yml, Environment = pypi.
# 3. Push a tag (e.g. `git tag v2.28.0 && git push --tags`) to trigger.
permissions:
contents: read
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Install build tooling
run: python -m pip install --upgrade pip build twine
- name: Verify tag matches package version
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION=$(python -c "import tomllib, pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Tag $GITHUB_REF_NAME does not match pyproject.toml version $PKG_VERSION"
exit 1
fi
- name: Build sdist + wheel
run: python -m build --sdist --wheel --outdir dist
- name: twine check
run: python -m twine check dist/*
- name: Upload distribution artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/code-context-control
permissions:
id-token: write # required for Trusted Publishing
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Attach artifacts to GitHub Release
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download distribution artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
files: dist/*
generate_release_notes: true
draft: false
prerelease: false