pumper
Automagically 🧚♀️ create branch, pull request, bump version (using Commitizen), approve and merge.
pumper helps create CI/CD bump version jobs more secure 👮♀️.
Common version bump strategy these days is to have CI/CD workflow run automatic version bump directly in a main branch:
This raises following concerns (among others) in highly secured environments:
- direct push to a main branch required
- branch protection rules needs to be relieved
- change in main branch is not reviewed
Bump strategy with pumper:
- Call great tool
Commitizen. It checks your commit history and bumps your version. Check it out for more information how to configure and use it. - Create a branch including changes from above step a push it.
- Create PR.
- Optionally approve a merge PR.
Quick install guide
pumper can be installed from PYPI. It's recommended to install it in isolated Python environment using venv.
python -m venv .venv
.venv/bin/pip install pumper
How to use it
Using CLI
pump create
Usage: pumper create [OPTIONS]
Bump version, push branch and create pull request.
╭─ Options ──────────────────────────────────────────────────────────────────────╮
│ * --repo TEXT The owner and repository name, eg 'owner/repo'. │
│ [env var: GITHUB_REPOSITORY] │
│ [default: None] │
│ [required] │
│ --url TEXT Github API url. │
│ [env var: GITHUB_API_URL] │
│ [default: https://api.github.com] │
│ * --token TEXT Github token. [env var: GITHUB_TOKEN] │
│ [default: None] [required] │
│ --base TEXT Base branch of a PR. [env var: BASE_BRANCH] │
│ [default: main] │
│ --branch TEXT Branch name and PR title. │
│ [default: release/{version}] │
│ --user TEXT Git user name. [default: github-actions[bot]] │
│ --email TEXT Git user email. │
│ [default: │
│ github-actions[bot]@users.noreply.github.com] │
│ --gh-env Create 'PR_NUM' env var for GH actions │
│ --label TEXT Add labels to PR. [default: None] │
│ --assign Assign PR [default: True] │
│ --assignee TEXT PR assignee name. [env var: GITHUB_ACTOR] │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────╯
pumper approve
Usage: pumper approve [OPTIONS] PR_NUM
Approve pull request.
╭─ Arguments ────────────────────────────────────────────────────────────────────╮
│ * pr_num INTEGER PR number. [env var: PR_NUM] [default: None] │
│ [required] │
╰────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────╮
│ * --repo TEXT The owner and repository name, eg 'owner/repo'. │
│ [env var: GITHUB_REPOSITORY] │
│ [default: None] │
│ [required] │
│ --url TEXT Github API url. │
│ [env var: GITHUB_API_URL] │
│ [default: https://api.github.com] │
│ * --token TEXT Github token. [env var: GITHUB_TOKEN] [default: None] │
│ [required] │
│ --body TEXT PR message. [default: 🤖 Approved by GH actions!] │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────╯
pumper merge
Usage: pumper merge [OPTIONS] PR_NUM
Merge pull request.
╭─ Arguments ───────────────────────────────────────────────────────────────────╮
│ * pr_num INTEGER PR number. [env var: PR_NUM] [default: None] │
│ [required] │
╰───────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────╮
│ --method [merge|squash|rebase] The merge method to use. │
│ [default: merge] │
│ * --repo TEXT The owner and repository name, eg │
│ 'owner/repo'. │
│ [env var: GITHUB_REPOSITORY] │
│ [default: None] │
│ [required] │
│ --url TEXT Github API url. │
│ [env var: GITHUB_API_URL] │
│ [default: https://api.github.com] │
│ * --token TEXT Github token. │
│ [env var: GITHUB_TOKEN] │
│ [default: None] │
│ [required] │
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────╯
Github actions
See my GH actions bumper.yaml workflow. Replace pip install . with pip install pumper==0.2.0 (line 31).
Required setup
- Allow GitHub Actions to create and approve pull requests in your repository settings.
- Depending on which token you want to use:
-
Actions
GITHUB_TOKENneeds following permissions:permissions: pull-requests: write contents: write
-
Github personal access tokens (classic) needs
public_reposcope for public repositories or fullreposcope for a private repositories.
-
Appreciation
Big thanks 🙏 to following libraries:
Release files for pumper 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pumper-0.2.0.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pumper-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / pumper-0.2.0.tar.gz
| Download URL | pumper-0.2.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e849ce0b5657bbae8c250c12f6a3535265d973ddfd349afaeacc28a4a9cd0336
|
|
BLAKE2b-256 checksum How to use checksums |
f5c8785aec529fb69de489401bc02ce030f638e095c6758c248c8ea15323e049
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|
Release files / pumper-0.2.0-py3-none-any.whl
| Download URL | pumper-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7f21b5256621ee6852d8241938ea46c472fe20b82d557965d1506415d806fb0
|
|
BLAKE2b-256 checksum How to use checksums |
ea2a14878234f6daa1091f50de57eb10ec7f0d001f1d82f730532df53c0b3787
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|