Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
pull_request:
branches: [main, dev/institutional-recovery]
branches: [main]
push:
branches: [main, dev/institutional-recovery]
branches: [main]

jobs:
checks:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish to PyPI

# Runs only when a GitHub Release is published (not on push or PR).
# Release flow: bump `version` in pyproject.toml and src/verdi/__init__.py,
# merge, then publish a release tagged v<version> (e.g. v0.1.1).
on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install
run: pip install -e ".[dev]" build twine
- name: Tag must match package version
run: |
tag="${GITHUB_REF_NAME#v}"
pkg=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
mod=$(python -c "import verdi; print(verdi.__version__)")
echo "tag=$tag pyproject=$pkg verdi.__version__=$mod"
if [ "$tag" != "$pkg" ] || [ "$tag" != "$mod" ]; then
echo "::error::Release tag v$tag does not match pyproject ($pkg) / __version__ ($mod)"
exit 1
fi
- name: Ruff
run: ruff check .
- name: Tests
run: python -m pytest
- name: Build
run: python -m build
- name: Check distributions
run: twine check --strict dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

publish:
needs: build
runs-on: ubuntu-latest
# Trusted publishing (OIDC): no API token stored in GitHub. Requires a
# trusted publisher on PyPI for SimulaMet/Verdi, workflow pypi.yml,
# environment "pypi".
environment:
name: pypi
url: https://pypi.org/project/verdi-agents/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ alongside the individual run reports. See the [researcher guide](docs/RESEARCHER

---

## Releasing

1. Bump `version` in `pyproject.toml` and `__version__` in `src/verdi/__init__.py`, and merge.
2. Publish a GitHub Release tagged `v<version>` (for example `v0.1.1`).

The [Publish to PyPI](.github/workflows/pypi.yml) workflow runs only on a
published release. It checks the tag matches the version, runs lint and tests,
builds, and uploads `verdi-agents` through PyPI trusted publishing (no token
stored in GitHub).

## Research principles

We distinguish **declared** values, **private** behavioral preferences, and
Expand Down
Loading