Releasing¶
For maintainers. Releases go to PyPI through
Trusted Publishing: the
release workflow
authenticates with a short-lived OpenID Connect token, so no API token is
stored in the repository.
| Trigger | What happens |
|---|---|
push a tag vX.Y.Z |
build, twine check, check that the tag equals citeqc.__version__, smoke-test the wheel, publish to PyPI |
| Actions, release, Run workflow | the same build and checks, then publish to TestPyPI (a dry run) |
One-time setup¶
1. Register the trusted publishers¶
The project does not exist on PyPI yet, so it is registered as a pending publisher; PyPI creates the project on the first successful upload. A pending publisher does not reserve the name, so publish soon after setting it up.
- Sign in at pypi.org (two-factor authentication must be on) and open Account settings, Publishing (pypi.org/manage/account/publishing).
-
Under Add a new pending publisher, choose GitHub and enter:
Field Value PyPI Project Name citeqcOwner elmasnuryilmazRepository name citeqcWorkflow name release.ymlEnvironment name pypi -
For dry runs, repeat on test.pypi.org (a separate account) with environment name
testpypi.
2. Create the GitHub environments¶
In the repository, Settings, Environments, New environment: create pypi
and, if you use TestPyPI, testpypi. Recommended for pypi:
- Required reviewers: yourself, so every upload waits for your approval;
- Deployment branches and tags: only tags matching
v*.
3. Enable GitHub Pages¶
Settings, Pages, Build and deployment, Source: GitHub Actions. The
docs workflow
then publishes the site on every push to main, at
https://elmasnuryilmaz.github.io/citeqc/. Pull requests build the site with
mkdocs build --strict but do not deploy it.
Each release¶
- Update the version in
src/citeqc/__init__.py(__version__, the only place it is set), move the Unreleased notes inCHANGELOG.mdunder the new version with today's date, and updateversionanddate-releasedinCITATION.cff. - Merge to
mainand wait for thetestsworkflow to pass. -
Optional dry run: Actions, release, Run workflow on
main, thenpip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ citeqcTestPyPI never accepts the same version twice; re-runs skip files that already exist.
-
Tag and push:
git tag -a v0.2.0 -m "citeqc 0.2.0"git push origin v0.2.0 -
Create a GitHub release from the tag, with the changelog entry as notes. If the repository is connected to Zenodo, this also archives the release and mints a DOI you can cite.