feat(gitutil): release v1.9.0 — detached HEAD support in CI
- CurrentBranch falls back to CI_COMMIT_BRANCH, CI_COMMIT_REF_NAME, then GITHUB_REF_NAME when HEAD is detached, so --branch is no longer required in GitLab CI / GitHub Actions jobs - go-git push paths (token and SSH agent) now push HEAD's commit hash to the branch instead of refs/heads/<branch>, which never exists in a detached CI checkout — go-git silently skipped the branch update and pushed only the tag - .releaser.gitlab-ci.yml template drops the redundant --branch flag - docs: README, usage, ci-integration, changelog, ROADMAP updated Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,16 @@ title: Changelog
|
||||
weight: 50
|
||||
---
|
||||
|
||||
## v1.9.0 — 2026-07-16
|
||||
|
||||
### Added
|
||||
|
||||
- **CI branch detection fallback** — on detached HEAD, the branch name falls back to `CI_COMMIT_BRANCH`, then `CI_COMMIT_REF_NAME` (GitLab CI), then `GITHUB_REF_NAME` (GitHub Actions); `--branch` is no longer required in CI
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Detached HEAD push** — go-git pushes silently skipped the branch update in detached CI checkouts (only the tag was pushed); the branch is now pushed from HEAD's commit hash
|
||||
|
||||
## v1.8.0 — 2026-07-12
|
||||
|
||||
### Added
|
||||
|
||||
@@ -95,7 +95,13 @@ jobs:
|
||||
|
||||
## Detached HEAD
|
||||
|
||||
In CI environments where `git checkout` leaves the repository in detached HEAD state, pass the branch name explicitly:
|
||||
CI runners check out a commit SHA, leaving the repository in detached HEAD state. `releaser` detects this and falls back to the branch name from the CI environment, in order:
|
||||
|
||||
1. `CI_COMMIT_BRANCH` (GitLab CI, branch pipelines)
|
||||
2. `CI_COMMIT_REF_NAME` (GitLab CI)
|
||||
3. `GITHUB_REF_NAME` (GitHub Actions)
|
||||
|
||||
So on branch pipelines no extra configuration is needed. To override the detected name (or on runners that set none of these variables), pass it explicitly:
|
||||
|
||||
```yaml
|
||||
script:
|
||||
|
||||
@@ -35,7 +35,7 @@ releaser --verbose --dry-run
|
||||
| Flag | Default | Description |
|
||||
|------|---------|-------------|
|
||||
| `--dry-run` | false | Print next version and exit without making any changes |
|
||||
| `--branch <name>` | auto-detected | Override branch name (useful in detached HEAD / CI) |
|
||||
| `--branch <name>` | auto-detected | Override branch name (detached HEAD falls back to `CI_COMMIT_BRANCH`, `CI_COMMIT_REF_NAME`, `GITHUB_REF_NAME`) |
|
||||
| `--branch-pattern <regex>` | `^(?:.*/)?release/(\d+)\.(\d+)$` | Override branch pattern (two capture groups: major, minor) |
|
||||
| `--tag-prefix <prefix>` | `""` | Prefix for version tags (e.g. `v` → `v1.2.3`) |
|
||||
| `--pom <path>` | `pom.xml` | Path to pom.xml relative to repo root |
|
||||
|
||||
Reference in New Issue
Block a user