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.
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
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. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
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. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
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. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
See my GH actions bumper.yaml
workflow. Replace pip install .
with pip install pumper==0.2.0
(line 31).
- Allow GitHub Actions to create and approve pull requests in your repository settings.
- Depending on which token you want to use:
-
Actions
GITHUB_TOKEN
needs following permissions:permissions: pull-requests: write contents: write
-
Github personal access tokens (classic) needs
public_repo
scope for public repositories or fullrepo
scope for a private repositories.
-
Big thanks ๐ to following libraries: