5af107b06d
- GitHub release support: internal/ghclient (no SDK, minimal HTTP client); GITHUB_TOKEN env var; github.token/github.repo config; GitHub takes precedence over GitLab when both are configured; publisher interface (releasePublisher) in cmd/main.go makes providers interchangeable - SSH agent push: gitutil.Push() now tries gitssh.NewSSHAgentAuth for git@/ssh:// remotes before falling back to the system git binary - --release-env-file flag: override dotenv artifact path; pass "" to disable - git.releasable_types config: filter which commit types trigger a bump (defaults to fix, feat, breaking); useful for maintenance branches - commits.Group(), ExtractSubject(), ReleasableSet() exported helpers: notes.go and changelog.go now delegate to these instead of duplicating - CHANGELOG deduplication guard: changelog.Update() is idempotent — skips write if ## [version] section already exists - Always load config sources: LoadWithSources() called unconditionally; removes the dual config path that previously only tracked sources in --verbose mode - .releaser.gitlab-ci.yml: adds artifacts: reports: dotenv: release.env Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.5 KiB
YAML
54 lines
1.5 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:
|
|
- releaser
|
|
--branch "$CI_COMMIT_BRANCH"
|
|
$RELEASER_EXTRA_ARGS
|
|
|
|
artifacts:
|
|
reports:
|
|
dotenv: release.env # exposes NEXT_VERSION to downstream jobs
|
|
|
|
environment:
|
|
name: release/$CI_COMMIT_BRANCH
|