Files
releaser/.releaser.gitlab-ci.yml
T
k3nny 2a6a65ce80
docs / Build and deploy docs (push) Failing after 32s
release / Build and publish release (push) Successful in 5m34s
ci / vet, staticcheck, test, build (push) Failing after 18m8s
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>
2026-07-16 21:12:24 +02:00

53 lines
1.6 KiB
YAML

# releaser — GitLab CI component template
#
# Usage in your project's .gitlab-ci.yml:
#
# include:
# - project: 'your-group/releaser'
# ref: main
# file: '.releaser.gitlab-ci.yml'
#
# stages:
# - build
# - test
# - release
#
# release:
# extends: .releaser:release
#
# Required CI variable (set at project or group level):
# RELEASE_TOKEN — a GitLab project/group access token with scopes:
# api + write_repository
# (do NOT use CI_JOB_TOKEN — it cannot push tags back)
.releaser:release:
stage: release
image: ${RELEASER_IMAGE:-registry.example.com/releaser:latest}
variables:
# Override in your job to change defaults
RELEASER_EXTRA_ARGS: "" # e.g. "--no-push" or "--tag-prefix ''"
GIT_DEPTH: 0 # full clone — required to find ancestor tags
rules:
- if: $CI_COMMIT_BRANCH =~ /^release\/.+$/
before_script:
# Configure git to push back using the release token over HTTPS.
# CI_JOB_TOKEN cannot push tags, so a dedicated access token is required.
- git remote set-url origin
"https://oauth2:${RELEASE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
- git config user.email "${GITLAB_USER_EMAIL:-ci@releaser}"
- git config user.name "${GITLAB_USER_NAME:-Releaser CI}"
script:
# No --branch needed: releaser falls back to CI_COMMIT_BRANCH on detached HEAD.
- releaser $RELEASER_EXTRA_ARGS
artifacts:
reports:
dotenv: release.env # exposes NEXT_VERSION to downstream jobs
environment:
name: release/$CI_COMMIT_BRANCH