Summary
Add a GitHub Actions workflow to automatically publish releases to PyPI when a version tag is pushed.
Prerequisites
Setting up Trusted Publishers (Recommended)
- Create/login to PyPI account at https://pypi.org
- Go to: Account → Publishing → Add a new pending publisher
- Configure:
- PyPI Project Name:
forge-anvil
- Owner:
agentic-forge
- Repository:
forge-anvil
- Workflow name:
release.yml
- Environment:
pypi (optional but recommended)
Implementation
Create .github/workflows/release.yml:
name: Release
on:
push:
tags:
- "v*"
jobs:
build:
name: Build Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install
- name: Build package
run: uv build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Release Process
Once configured, to release a new version:
# Update version in pyproject.toml
# Commit the change
git tag v0.1.0
git push origin v0.1.0
Acceptance Criteria
Summary
Add a GitHub Actions workflow to automatically publish releases to PyPI when a version tag is pushed.
Prerequisites
forge-anvilpackage name on PyPISetting up Trusted Publishers (Recommended)
forge-anvilagentic-forgeforge-anvilrelease.ymlpypi(optional but recommended)Implementation
Create
.github/workflows/release.yml:Release Process
Once configured, to release a new version:
Acceptance Criteria