Skip to content

Add PyPI publish CD (release-labelled PR -> build & upload)#30

Open
poissoncorp wants to merge 1 commit into
ravendb:v7.2from
poissoncorp:add-pypi-cd
Open

Add PyPI publish CD (release-labelled PR -> build & upload)#30
poissoncorp wants to merge 1 commit into
ravendb:v7.2from
poissoncorp:add-pypi-cd

Conversation

@poissoncorp

Copy link
Copy Markdown
Contributor

What

Adds a two-stage, PR-gated CD pipeline that publishes ravendb-embedded to PyPI via GitHub Actions.

  • prepare-release.yml (manual): run from the Actions tab with a version input. Bumps the version across setup.py (RAVENDB_VERSION, version=, the ravendb~= pin) and requirements.txt, then opens a PR labelled release.
  • publish.yml: when a PR carrying the release label is merged, builds the package (sdist then bdist_wheel, in that order so the bundled RavenDB server is included), uploads to PyPI via twine using __token__, then creates the <version> git tag + GitHub release. Also runnable manually as a fallback.

How to release

  1. Actions → "Prepare release PR" → Run workflow → enter e.g. 7.2.2.
  2. Review the generated PR (adjust manually if the server version must differ from the package version).
  3. Merge it (keep the release label) → the package publishes automatically.

Remove the release label before merging to merge without publishing.

Required setup (one-time)

  • Add repo secret PYPI_API_TOKEN — a project-scoped PyPI API token.
  • Settings → Actions → General → Workflow permissions → enable "Allow GitHub Actions to create and approve pull requests" (so prepare-release can open the PR).

Notes

  • A human merge of the labelled PR triggers publish (the bot opening the PR with GITHUB_TOKEN does not auto-trigger). Auto-merge would need a PAT for create-pull-request.
  • publish.yml evaluates on every closed PR but only proceeds for merged + release-labelled PRs.
  • twine --skip-existing keeps re-runs idempotent.

Adds two GitHub Actions workflows:
- prepare-release.yml: manual dispatch; bumps version in setup.py/requirements.txt
  and opens a PR labelled "release".
- publish.yml: on merge of the labelled PR, builds (sdist then wheel so the
  bundled RavenDB server is included), uploads to PyPI via twine, then creates
  the version git tag + GitHub release.

Requires repo secret PYPI_API_TOKEN and the "Allow GitHub Actions to create and
approve pull requests" setting enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant