4.4 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 the app's __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.
- A version file containing a stable
MAJOR.MINOR.PATCHassignment such as__version__ = "0.0.1".
No bump-my-version configuration is required in the consuming app. The action passes the current version, search/replace templates, and version file directly to the CLI.
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
# The absolute URL is required when Gitea's DEFAULT_ACTIONS_URL is "github".
uses: https://gitea.cptckp.com/Nurinda/bump-erp-app-version@v1
with:
version-file: erp_operations/__init__.py
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 |
|---|---|---|
version-file |
required | App __init__.py containing the authoritative __version__ |
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.
The configured version-file is the only version source. The action reads it from both branches and commits only the version change produced by bump-my-version.
Releasing the action
Create and push an immutable semantic-version tag:
git tag -a v1.1.0 -m "Release v1.1.0"
git push origin v1.1.0
The Update major version tag Gitea workflow validates the release tag and automatically moves the corresponding floating major tag (for example, v1) to the same commit. Consumers can continue using Nurinda/bump-erp-app-version@v1 to receive compatible v1 releases.
Development
Run the integration test:
./tests/integration.sh
The test creates a temporary Git remote and verifies bumping, committing, pushing, and idempotent reruns.