--- name: bump-version description: Bump the app version, commit, tag, and push arguments: - name: version description: "Version number (e.g. 0.3.7). If omitted, auto-increments the patch version." required: false --- # Bump Version ## Steps 1. **Fetch remote**: Run `git fetch origin` to get latest state. 2. **Check if local is behind**: If local branch is behind remote, rebase first (`git rebase origin/{branch}`). Stash unstaged changes if needed. 3. **Determine version**: If `$ARGUMENTS` is provided, use it (strip leading `v` if present). Otherwise, read `config/version.yaml`, parse the current `app.version`, and increment the patch number (e.g. `0.3.6` → `0.3.7`). 4. **Check remote tags**: Run `git ls-remote --tags origin` and verify tag `v{version}` does NOT already exist. If it does, keep incrementing patch until a free version is found, or ERROR if a specific version was requested. 5. **Update version file**: Edit `config/version.yaml` to set `app.version: '{version}'`. 6. **Stage version file**: `git add config/version.yaml` — ALWAYS stage this file explicitly. 7. **Also stage any other pending changes**: Check `git status` for other staged files. If there are unstaged changes to tracked files, ask the user if they should be included. 8. **Commit**: Commit with message `chore : bump version to v{version}`. 9. **Tag**: Create git tag `v{version}`. 10. **Push**: Run `git push origin {current_branch} --tags`. 11. **Confirm**: Display the new version, tag, and push result. ## Critical Rules - The version in `config/version.yaml` MUST always match the git tag. - ALWAYS check remote tags BEFORE committing to avoid conflicts. - ALWAYS `git add config/version.yaml` explicitly — never assume it's staged. - ALWAYS fetch and sync with remote BEFORE starting. - Format: `v{version}` for tags (e.g. `v0.3.7`), without `v` in yaml (e.g. `0.3.7`).