fix version bump strategy

This commit is contained in:
2026-03-14 17:56:08 +01:00
parent 6f1913a542
commit 69fe519f7a
2 changed files with 178 additions and 30 deletions

View File

@@ -4,6 +4,43 @@ This repo provides reusable Gitea Actions as composite actions that can be refer
### Bump Version
Creates or updates the version in `package.json`, commits it, creates a matching Git tag, and pushes both.
Inputs:
- `node_version`: Node.js version to use. Default: `24`
- `release_line`: optional release line for dev builds when it cannot be derived from the branch or PR target. Format: `<major>.<minor>`
- `gitea_token`: optional token used for checkout and push
Branch and tag rules:
- `main`: creates release tags from the latest commit message (`release/x.y.z`, `release/x.y`, `hotfix/x.y.z`) or falls back to a patch bump.
- `release/<major>.<minor>`: creates the next beta tag for that release line, e.g. `v2.4.0-beta.3`.
- all other branches: create a dev tag for the resolved release line using a UTC timestamp, e.g. `v2.4.0-dev.20260314153045`.
Dev release line resolution order:
- `inputs.release_line`
- current branch if it matches `release/<major>.<minor>`
- PR target branch if it matches `release/<major>.<minor>`
- on `develop`, fallback to `major.minor` from `package.json`
If no release line can be resolved for a dev build, the action fails intentionally.
Examples:
Commit message examples on `main`:
- `release/2.4.0` -> `v2.4.0`
- `release/2.4` -> `v2.4.0`
- `hotfix/2.4.1` -> `v2.4.1`
Branch examples:
- `release/2.4` -> next `v2.4.0-beta.N`
- feature branch in a PR to `release/2.4` -> `v2.4.0-dev.<UTC_TIMESTAMP>`
- feature branch outside a PR with `release_line: 2.4` -> `v2.4.0-dev.<UTC_TIMESTAMP>`
Example:
```yaml
@@ -18,6 +55,21 @@ jobs:
gitea_token: ${{ secrets.GITEA_TOKEN }}
```
Feature branch outside a PR:
```yaml
jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: tanztee/ci-cd/.github/actions/bump-version@main
with:
gitea_token: ${{ secrets.GITEA_TOKEN }}
release_line: 2.4
```
### Build and Push Docker Image
Example: