diff --git a/.github/RELEASING.md b/.github/RELEASING.md new file mode 100644 index 0000000..d4e158f --- /dev/null +++ b/.github/RELEASING.md @@ -0,0 +1,11 @@ +# Releasing the client + +A code release is a GitHub release whose tag is `v`, e.g. `v0.2.0rc1` or `v0.2.0`. Publishing it runs `.github/workflows/release.yaml`, which builds the package with `uv build` and uploads it to PyPI by trusted publishing (environment `pypi`). The version comes from the tag through hatch-vcs. Data releases (`catalog-*`, `primers-*`, `tech-primers-*`) never publish, and `release-guard.yaml` re-marks the newest catalog release as Latest after a code release. The release notes are GitHub's generated notes; the repository has no CHANGELOG. + +## Checklist +1. Catalog schema: `SUPPORTED_CATALOG_SCHEMA` in `src/sddb/_catalog_schema.py` must be at least the `catalog_schema_version` of the newest catalog release, because the client refuses a newer catalog. Check with `gh release download -p release_info.json -O - | jq .catalog_schema_version`. +2. Behaviour changes: read the merged PRs since the last `v*` tag. If a default changes, write it at the top of the release notes in one sentence, e.g. `to_anndata` and `materialize` keep only in-tissue rows by default (#85). +3. Tests: the `Test` workflow on `main` passes. Run `pytest -m network` locally once against the newest catalog. +4. First release only: the pending trusted publishers for `spatialdata-db` exist on PyPI (environment `pypi`) and TestPyPI (environment `testpypi`). Run the workflow once from the Actions tab on the `v*` tag ("Run workflow") to upload to TestPyPI, and check `pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ spatialdata-db==`. +5. Publish the GitHub release (generate the notes). Mark a release candidate as a pre-release. Don't mark it Latest. +6. After the release: move the install pins in README, docs and the primer envs to the new tag, as in #88. diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6715a1e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,66 @@ +name: Release + +# From the scverse cookiecutter (scverse/cookiecutter-scverse@f46993f, .github/workflows/release.yaml). +# Only code releases (tags v*, pre-releases such as v0.2.0rc1 included) publish; catalog-*, primers-* and +# tech-primers-* data releases never do. The TestPyPI job is for a dry run before the first PyPI release: +# run it from the Actions tab ("Run workflow") on a v* tag. +on: + release: + types: [published] + workflow_dispatch: + +# Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/ +permissions: {} + +jobs: + release: + name: Upload release to PyPI + if: github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v') + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/spatialdata-db + permissions: + contents: read + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + filter: blob:none + fetch-depth: 0 + persist-credentials: false + - name: Install uv + uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 + with: + enable-cache: false + - name: Build package + run: uv build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + + testpypi: + name: Upload to TestPyPI + if: github.event_name == 'workflow_dispatch' && startsWith(github.ref_name, 'v') + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://test.pypi.org/p/spatialdata-db + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + filter: blob:none + fetch-depth: 0 + persist-credentials: false + - name: Install uv + uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 + with: + enable-cache: false + - name: Build package + run: uv build + - name: Publish package distributions to TestPyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + with: + repository-url: https://test.pypi.org/legacy/