feat(releaser): write release.env dotenv artifact on every release
ci / vet, staticcheck, test, build (push) Successful in 3m9s

After the next version is determined and dry-run is confirmed off,
release.env is written to the repository root:

  NEXT_VERSION=<nextTag>

This file is not committed — it is left as an untracked artifact so
GitLab CI can expose it as a dotenv artifact and pass NEXT_VERSION to
downstream jobs (e.g. deploy, notify).

The file is skipped in --dry-run mode. Two tests added:
TestRunReleaseEnv and TestRunReleaseEnvDryRun.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 13:54:38 +02:00
parent 12cb3a71af
commit 2614f23856
2 changed files with 48 additions and 0 deletions
+7
View File
@@ -387,6 +387,13 @@ func run(o options) error {
return nil
}
// --- release.env (GitLab CI dotenv artifact) ---
releaseEnvPath := filepath.Join(absRepo, "release.env")
if err := os.WriteFile(releaseEnvPath, []byte("NEXT_VERSION="+nextTag+"\n"), 0644); err != nil {
return fmt.Errorf("write release.env: %w", err)
}
logDone("release.env: NEXT_VERSION=%s", nextTag)
// --- pom.xml + CHANGELOG.md (skipped with --tag-only) ---
if !o.tagOnly {
var filesToCommit []string