Releasing¶
Releases are driven by tags. Pushing vX.Y.Z runs the Release workflow:
- Build: checks that the tag matches
versioninpyproject.toml, builds the sdist and wheel, and runstwine check --strict. - Publish: uploads to PyPI with one of two methods.
- Docker: builds the image for
linux/amd64andlinux/arm64and pushes it toghcr.io/sadrmanesh/persian-ragwith the tagsX.Y.Z,X.Y, andlatest. It signs in with the workflow'sGITHUB_TOKEN, so no extra secret is needed.
| Method | Setup |
|---|---|
| Trusted publishing (recommended) | Add a trusted publisher on PyPI for this repository, workflow release.yml, environment pypi. Then set the repository variable PYPI_TRUSTED_PUBLISHING to true. |
| API token | Add a PYPI_API_TOKEN repository secret. |
If neither is configured, the build still runs, the publish job prints a notice, and nothing is uploaded.
Checklist¶
- Update
versioninpyproject.tomlandsrc/persian_rag/version.py. - Add a section to
CHANGELOG.md. - Merge to
mainwith green CI. - Tag and push:
git tag v0.3.1 && git push origin v0.3.1.
The release workflow also copies the GHCR image, for every platform, to Docker Hub as docker.io/<DOCKERHUB_USERNAME>/persian-rag with the same X.Y.Z, X.Y, and latest tags. This job runs only when the DOCKERHUB_USERNAME and DOCKERHUB_TOKEN repository secrets are set, and skips with a notice otherwise.
Mirrors¶
.github/workflows/mirror.yml pushes main and every tag to gitlab.com/sadrmanesh/persian-rag. It runs only when the GITLAB_TOKEN repository secret is set (a GitLab access token with the write_repository scope) and skips with a notice otherwise. Set the GITLAB_NAMESPACE repository variable to mirror to another GitLab namespace. GitHub stays the main repository for issues and pull requests.