3.8 KiB
Bump ERP App Version
A forge-neutral composite action for preparing a versioned Frappe/ERPNext app before merging its release branch. It uses bump-my-version and ordinary Git commands, without gh or GitHub API calls.
The action compares [tool.bumpversion].current_version on the checked-out target branch with the configured base branch:
- Equal: bump, commit, and optionally push the new version.
- Target newer than base: do nothing, making PR synchronization events idempotent.
- Target older than base: fail and require branch synchronization.
Requirements
- A Linux runner with Bash, Git, and Python 3.11 or newer.
- A clean checkout of the branch that should receive the version commit.
- Persisted Git credentials with permission to push that branch.
- Stable
MAJOR.MINOR.PATCHversions. - A
bump-my-versionconfiguration that includes every version file.
Example pyproject.toml for a Frappe app:
[tool.bumpversion]
current_version = "0.0.1"
commit = false
tag = false
[[tool.bumpversion.files]]
filename = "erp_operations/__init__.py"
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'
Gitea Actions usage
name: Prepare application version
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
permissions:
contents: write
pull-requests: read
jobs:
version:
if: ${{ gitea.head_ref == 'develop' }}
runs-on: ubuntu-latest
steps:
- name: Check out develop
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
ref: develop
fetch-depth: 0
token: ${{ secrets.GITEA_TOKEN }}
- name: Prepare version
id: version
uses: Nurinda/bump-erp-app-version@v1
with:
config-file: pyproject.toml
base-branch: main
target-branch: develop
bump: patch
git-user-name: ERP Operations Release Bot
git-user-email: it@nurinda.co.id
- name: Report version
run: echo "${{ steps.version.outputs.previous-version }} -> ${{ steps.version.outputs.current-version }}"
Gitea may suppress workflows caused by pushes authenticated with its built-in GITEA_TOKEN. If CI checks must rerun on the generated commit, pass a narrowly scoped bot repository token to actions/checkout instead.
Inputs
| Input | Default | Description |
|---|---|---|
config-file |
pyproject.toml |
bump-my-version TOML configuration |
base-branch |
main |
Branch providing the baseline version |
target-branch |
develop |
Checked-out branch receiving the commit |
bump |
patch |
major, minor, or patch |
remote |
origin |
Git remote used for fetch and push |
commit-message |
chore(release): prepare v{version} |
Version commit message |
git-user-name |
ERP App Release Bot |
Git commit identity |
git-user-email |
actions@localhost |
Git commit identity |
bump-my-version-version |
1.5.1 |
Exact package version installed in an isolated environment |
push |
true |
Whether to push the created commit |
Outputs
| Output | Description |
|---|---|
bumped |
true when a commit was created |
previous-version |
Version before the action ran |
current-version |
Version after the action ran |
commit |
Created commit SHA, empty for a no-op |
Safety behavior
The action does not force-push, create tags, publish releases, or call forge APIs. Concurrent release jobs are resolved safely by the remote rejecting a non-fast-forward push. Configure workflow-level concurrency if release PRs can overlap.
Development
Run the integration test:
./tests/integration.sh
The test creates a temporary Git remote and verifies bumping, committing, pushing, and idempotent reruns.