Compare commits
9 Commits
3ea4af158e
...
v0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5ecfeebde | ||
|
|
6bcc027076 | ||
|
|
fd23a8b238 | ||
|
|
3f7edea46e | ||
|
|
0234df7aa1 | ||
|
|
501ac71147 | ||
|
|
60bbc7409b | ||
|
|
4c5a49d685 | ||
|
|
87059d21fd |
21
README.md
21
README.md
@@ -1,8 +1,8 @@
|
||||
# vociferate
|
||||
|
||||
[](https://git.hrafn.xyz/aether/vociferate/actions/workflows/push-validation.yml)
|
||||
[](https://git.hrafn.xyz/aether/vociferate/actions/workflows/prepare-release.yml)
|
||||
[](https://git.hrafn.xyz/aether/vociferate/actions/workflows/do-release.yml)
|
||||
[](https://git.hrafn.xyz/aether/vociferate/actions/runs/latest?workflow=push-validation.yml&branch=main&event=push)
|
||||
[](https://git.hrafn.xyz/aether/vociferate/actions/runs/latest?workflow=prepare-release.yml)
|
||||
[](https://git.hrafn.xyz/aether/vociferate/actions/runs/latest?workflow=do-release.yml)
|
||||
[](https://s3.hrafn.xyz/aether-workflow-report-artefacts/vociferate/branch/main/coverage.html)
|
||||
|
||||
`vociferate` is an `aether` release orchestration tool written in Go for repositories that
|
||||
@@ -17,7 +17,7 @@ revision.
|
||||
## Use In Other Repositories
|
||||
|
||||
Vociferate ships two composite actions that together cover the full release flow.
|
||||
Pin both to the same released tag.
|
||||
Until release tags are created, reference `@main`. Once tags exist again, pin both actions to the same released tag.
|
||||
|
||||
### `prepare` — update files, commit, and push tag
|
||||
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: git.hrafn.xyz/aether/vociferate/prepare@v1.0.0
|
||||
- uses: git.hrafn.xyz/aether/vociferate/prepare@main
|
||||
with:
|
||||
version: ${{ inputs.version }}
|
||||
|
||||
@@ -59,7 +59,7 @@ For repositories that embed the version inside source code, pass `version-file`
|
||||
and `version-pattern`:
|
||||
|
||||
```yaml
|
||||
- uses: git.hrafn.xyz/aether/vociferate/prepare@v1.0.0
|
||||
- uses: git.hrafn.xyz/aether/vociferate/prepare@main
|
||||
with:
|
||||
version-file: internal/myapp/version/version.go
|
||||
version-pattern: 'const Version = "([^"]+)"'
|
||||
@@ -98,7 +98,7 @@ assets after it runs:
|
||||
|
||||
```yaml
|
||||
- id: publish
|
||||
uses: git.hrafn.xyz/aether/vociferate/publish@v1.0.0
|
||||
uses: git.hrafn.xyz/aether/vociferate/publish@main
|
||||
|
||||
- name: Upload my binary
|
||||
run: |
|
||||
@@ -167,12 +167,7 @@ Defaults:
|
||||
|
||||
When no `--version-file` flag is provided, `vociferate` derives the current version from the most recent released section heading in the changelog (`## [x.y.z] - ...`). If no prior releases exist, it defaults to `0.0.0` and recommends `v1.0.0` as the first tag.
|
||||
|
||||
During prepare, vociferate also normalizes changelog heading links when it can determine the repository URL (from CI environment variables or `origin` git remote):
|
||||
|
||||
- `## [Unreleased]` becomes a link to the repository main branch.
|
||||
- `## [x.y.z] - YYYY-MM-DD` becomes a link to the corresponding release page.
|
||||
|
||||
If the repository URL cannot be determined, headings remain in plain form.
|
||||
During prepare, vociferate can normalize changelog heading links when it can determine the repository URL (from CI environment variables or `origin` git remote). If you prefer changelog headings to stay plain while tags are being rebuilt, leave the changelog as plain headings and avoid retaining historical release-tag links.
|
||||
|
||||
When running `--version`, the `release-version` file is created automatically if it does not exist, so new repositories do not need to pre-seed it.
|
||||
|
||||
|
||||
19
changelog.md
19
changelog.md
@@ -7,12 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
A `### Breaking` section is used in addition to Keep a Changelog's standard sections to explicitly document changes that are backwards-incompatible but would otherwise appear under `### Changed`. Entries under `### Breaking` trigger a major version bump in automated release recommendation logic.
|
||||
|
||||
## [Unreleased](https://git.hrafn.xyz/aether/vociferate/src/branch/main)
|
||||
## [Unreleased]
|
||||
|
||||
## [1.0.0](https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.0.0) - 2026-03-20
|
||||
## [0.1.0] - 2026-03-20
|
||||
|
||||
### Changed
|
||||
|
||||
- README workflow badges now link to the latest workflow run pages instead of the workflow definition pages.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Publish action falls back to `git describe` when `inputs.version` is empty and `GITHUB_REF` is not a tag ref, resolving `workflow_call` input propagation failures in act runner v0.3.0.
|
||||
|
||||
### Added
|
||||
|
||||
- Coverage badge in README linked to S3-hosted main-branch report.
|
||||
- S3 coverage artefact publishing (HTML report, badge, JSON summary) in push validation pipeline.
|
||||
- CLI tests and internal helper tests raising total coverage to 84%.
|
||||
- Test suite isolation against ambient CI environment variables for changelog link generation tests.
|
||||
- Go CLI for changelog-driven release preparation and semantic version recommendation.
|
||||
- Version recommendation from changelog release headings, including first-release support (`0.0.0` base -> `v1.0.0`).
|
||||
- Automatic `release-version` creation/update during release preparation.
|
||||
@@ -30,3 +42,6 @@ A `### Breaking` section is used in addition to Keep a Changelog's standard sect
|
||||
- Reusable Gitea workflows (`prepare-release.yml`, `do-release.yml`) with `workflow_call` support.
|
||||
- Project/automation rename from `releaseprep` to `vociferate` (entrypoint, package paths, outputs).
|
||||
- README guidance focused on primary cross-repository reuse workflows.
|
||||
|
||||
[Unreleased]: http://teapot:3000/aether/vociferate/src/branch/main
|
||||
[0.1.0]: http://teapot:3000/aether/vociferate/releases/tag/v0.1.0
|
||||
|
||||
120
cmd/vociferate/main_test.go
Normal file
120
cmd/vociferate/main_test.go
Normal file
@@ -0,0 +1,120 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMainRecommendPrintsTag(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeFile(t, filepath.Join(root, "release-version"), "1.1.6\n")
|
||||
writeFile(t, filepath.Join(root, "changelog.md"), "# Changelog\n\n## [Unreleased]\n\n### Added\n\n- Feature.\n\n## [1.1.6] - 2017-12-20\n")
|
||||
|
||||
stdout, stderr, code := runMain(t, "--recommend", "--root", root)
|
||||
if code != 0 {
|
||||
t.Fatalf("expected exit 0, got %d (stderr: %s)", code, stderr)
|
||||
}
|
||||
if strings.TrimSpace(stdout) != "v1.2.0" {
|
||||
t.Fatalf("unexpected recommended tag: %q", strings.TrimSpace(stdout))
|
||||
}
|
||||
}
|
||||
|
||||
func TestMainUsageExitWhenRequiredFlagsMissing(t *testing.T) {
|
||||
_, stderr, code := runMain(t)
|
||||
if code != 2 {
|
||||
t.Fatalf("expected exit 2, got %d", code)
|
||||
}
|
||||
if !strings.Contains(stderr, "usage: vociferate") {
|
||||
t.Fatalf("expected usage text in stderr, got: %s", stderr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMainPrepareUpdatesFiles(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeFile(t, filepath.Join(root, ".git", "config"), "[remote \"origin\"]\n\turl = git@git.hrafn.xyz:aether/vociferate.git\n")
|
||||
writeFile(t, filepath.Join(root, "release-version"), "1.1.6\n")
|
||||
writeFile(t, filepath.Join(root, "changelog.md"), "# Changelog\n\n## [Unreleased]\n\n### Fixed\n\n- Patch note.\n\n## [1.1.6] - 2017-12-20\n")
|
||||
|
||||
_, stderr, code := runMain(t, "--version", "v1.1.7", "--date", "2026-03-20", "--root", root)
|
||||
if code != 0 {
|
||||
t.Fatalf("expected exit 0, got %d (stderr: %s)", code, stderr)
|
||||
}
|
||||
|
||||
versionBytes, err := os.ReadFile(filepath.Join(root, "release-version"))
|
||||
if err != nil {
|
||||
t.Fatalf("read release-version: %v", err)
|
||||
}
|
||||
if strings.TrimSpace(string(versionBytes)) != "1.1.7" {
|
||||
t.Fatalf("unexpected version file value: %q", string(versionBytes))
|
||||
}
|
||||
}
|
||||
|
||||
func TestMainPrepareReturnsExitOneOnFailure(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
_, stderr, code := runMain(t, "--version", "v1.1.7", "--date", "2026-03-20", "--root", root)
|
||||
if code != 1 {
|
||||
t.Fatalf("expected exit 1, got %d", code)
|
||||
}
|
||||
if !strings.Contains(stderr, "prepare release") {
|
||||
t.Fatalf("expected prepare error in stderr, got: %s", stderr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHelperProcess(t *testing.T) {
|
||||
if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" {
|
||||
return
|
||||
}
|
||||
|
||||
idx := -1
|
||||
for i, arg := range os.Args {
|
||||
if arg == "--" {
|
||||
idx = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if idx == -1 {
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
args := append([]string{"vociferate"}, os.Args[idx+1:]...)
|
||||
os.Args = args
|
||||
flag.CommandLine = flag.NewFlagSet(args[0], flag.ExitOnError)
|
||||
|
||||
main()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func runMain(t *testing.T, args ...string) (string, string, int) {
|
||||
t.Helper()
|
||||
|
||||
cmdArgs := append([]string{"-test.run=TestHelperProcess", "--"}, args...)
|
||||
cmd := exec.Command(os.Args[0], cmdArgs...)
|
||||
cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1")
|
||||
|
||||
out, err := cmd.CombinedOutput()
|
||||
output := string(out)
|
||||
if err == nil {
|
||||
return output, "", 0
|
||||
}
|
||||
|
||||
if exitErr, ok := err.(*exec.ExitError); ok {
|
||||
return "", output, exitErr.ExitCode()
|
||||
}
|
||||
|
||||
t.Fatalf("run helper process: %v", err)
|
||||
return "", "", -1
|
||||
}
|
||||
|
||||
func writeFile(t *testing.T, path, content string) {
|
||||
t.Helper()
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
||||
t.Fatalf("mkdir for %s: %v", path, err)
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
|
||||
t.Fatalf("write file %s: %v", path, err)
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ var releasedSectionRe = regexp.MustCompile(`(?m)^## \[(\d+\.\d+\.\d+)\] - `)
|
||||
var linkedReleasedSectionRe = regexp.MustCompile(`(?m)^## \[(\d+\.\d+\.\d+)\](?:\([^\n)]*\))? - `)
|
||||
var unreleasedHeadingRe = regexp.MustCompile(`(?m)^## \[Unreleased\](?:\([^\n)]*\))?\n`)
|
||||
var releaseHeadingRe = regexp.MustCompile(`(?m)^## \[(\d+\.\d+\.\d+)\](?:\([^\n)]*\))? - `)
|
||||
var refLinkLineRe = regexp.MustCompile(`^\[[^\]]+\]: \S`)
|
||||
|
||||
type Options struct {
|
||||
// VersionFile is the path to the file that stores the current version,
|
||||
@@ -412,19 +413,38 @@ func addChangelogLinks(text, repoURL string) string {
|
||||
return text
|
||||
}
|
||||
|
||||
mainURL := repoURL + "/src/branch/main"
|
||||
text = unreleasedHeadingRe.ReplaceAllString(text, fmt.Sprintf("## [Unreleased](%s)\n", mainURL))
|
||||
|
||||
// Normalize headings to plain format, stripping any existing inline links.
|
||||
text = unreleasedHeadingRe.ReplaceAllString(text, "## [Unreleased]\n")
|
||||
text = releaseHeadingRe.ReplaceAllStringFunc(text, func(match string) string {
|
||||
parts := releaseHeadingRe.FindStringSubmatch(match)
|
||||
if len(parts) < 2 {
|
||||
return match
|
||||
}
|
||||
version := parts[1]
|
||||
return fmt.Sprintf("## [%s](%s/releases/tag/v%s) - ", version, repoURL, version)
|
||||
return fmt.Sprintf("## [%s] - ", version)
|
||||
})
|
||||
|
||||
return text
|
||||
// Strip any trailing reference link block (blank lines followed by ref link lines).
|
||||
lines := strings.Split(strings.TrimRight(text, "\n"), "\n")
|
||||
cutAt := len(lines)
|
||||
for i := len(lines) - 1; i >= 0; i-- {
|
||||
if strings.TrimSpace(lines[i]) == "" || refLinkLineRe.MatchString(lines[i]) {
|
||||
cutAt = i
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
text = strings.Join(lines[:cutAt], "\n") + "\n"
|
||||
|
||||
// Build and append reference link definitions.
|
||||
linkDefs := []string{fmt.Sprintf("[Unreleased]: %s/src/branch/main", repoURL)}
|
||||
for _, match := range releasedSectionRe.FindAllStringSubmatch(text, -1) {
|
||||
if len(match) >= 2 {
|
||||
linkDefs = append(linkDefs, fmt.Sprintf("[%s]: %s/releases/tag/v%s", match[1], repoURL, match[1]))
|
||||
}
|
||||
}
|
||||
|
||||
return strings.TrimRight(text, "\n") + "\n\n" + strings.Join(linkDefs, "\n") + "\n"
|
||||
}
|
||||
|
||||
func parseSemver(version string) (semver, error) {
|
||||
|
||||
123
internal/vociferate/vociferate_internal_test.go
Normal file
123
internal/vociferate/vociferate_internal_test.go
Normal file
@@ -0,0 +1,123 @@
|
||||
package vociferate
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNormalizeRepoURL(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
remoteURL string
|
||||
wantURL string
|
||||
wantOK bool
|
||||
}{
|
||||
{name: "https", remoteURL: "https://git.hrafn.xyz/aether/vociferate.git", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
|
||||
{name: "http", remoteURL: "http://teapot:3000/aether/vociferate.git", wantURL: "http://teapot:3000/aether/vociferate", wantOK: true},
|
||||
{name: "ssh with scheme", remoteURL: "ssh://git@git.hrafn.xyz/aether/vociferate.git", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
|
||||
{name: "scp style", remoteURL: "git@git.hrafn.xyz:aether/vociferate.git", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
|
||||
{name: "empty", remoteURL: "", wantURL: "", wantOK: false},
|
||||
{name: "unsupported scheme", remoteURL: "ftp://example.com/repo.git", wantURL: "", wantOK: false},
|
||||
{name: "invalid ssh missing user", remoteURL: "ssh://git.hrafn.xyz/aether/vociferate.git", wantURL: "", wantOK: false},
|
||||
{name: "invalid scp style", remoteURL: "git.hrafn.xyz:aether/vociferate.git", wantURL: "", wantOK: false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
gotURL, gotOK := normalizeRepoURL(tt.remoteURL)
|
||||
if gotOK != tt.wantOK {
|
||||
t.Fatalf("normalizeRepoURL(%q) ok = %v, want %v", tt.remoteURL, gotOK, tt.wantOK)
|
||||
}
|
||||
if gotURL != tt.wantURL {
|
||||
t.Fatalf("normalizeRepoURL(%q) url = %q, want %q", tt.remoteURL, gotURL, tt.wantURL)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseSemver(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
want semver
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "valid", input: "1.2.3", want: semver{major: 1, minor: 2, patch: 3}, wantErr: false},
|
||||
{name: "missing part", input: "1.2", wantErr: true},
|
||||
{name: "non numeric", input: "1.two.3", wantErr: true},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
got, err := parseSemver(tt.input)
|
||||
if tt.wantErr {
|
||||
if err == nil {
|
||||
t.Fatalf("parseSemver(%q) expected error", tt.input)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("parseSemver(%q) unexpected error: %v", tt.input, err)
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Fatalf("parseSemver(%q) = %+v, want %+v", tt.input, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestOriginRemoteURLFromGitConfig(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("origin exists", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
config := "[core]\n\trepositoryformatversion = 0\n[remote \"origin\"]\n\turl = git@git.hrafn.xyz:aether/vociferate.git\n"
|
||||
url, ok := originRemoteURLFromGitConfig(config)
|
||||
if !ok {
|
||||
t.Fatal("expected origin url to be found")
|
||||
}
|
||||
if url != "git@git.hrafn.xyz:aether/vociferate.git" {
|
||||
t.Fatalf("unexpected url: %q", url)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("origin missing", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
config := "[core]\n\trepositoryformatversion = 0\n[remote \"upstream\"]\n\turl = git@git.hrafn.xyz:aether/vociferate.git\n"
|
||||
_, ok := originRemoteURLFromGitConfig(config)
|
||||
if ok {
|
||||
t.Fatal("expected origin url to be absent")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeriveRepositoryURLFromGitConfigFallback(t *testing.T) {
|
||||
t.Setenv("GITHUB_SERVER_URL", "")
|
||||
t.Setenv("GITHUB_REPOSITORY", "")
|
||||
|
||||
root := t.TempDir()
|
||||
configPath := filepath.Join(root, ".git", "config")
|
||||
if err := os.MkdirAll(filepath.Dir(configPath), 0o755); err != nil {
|
||||
t.Fatalf("mkdir .git: %v", err)
|
||||
}
|
||||
if err := os.WriteFile(configPath, []byte("[remote \"origin\"]\n\turl = git@git.hrafn.xyz:aether/vociferate.git\n"), 0o644); err != nil {
|
||||
t.Fatalf("write git config: %v", err)
|
||||
}
|
||||
|
||||
url, ok := deriveRepositoryURL(root)
|
||||
if !ok {
|
||||
t.Fatal("expected repository URL from git config")
|
||||
}
|
||||
if url != "https://git.hrafn.xyz/aether/vociferate" {
|
||||
t.Fatalf("unexpected repository URL: %q", url)
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func (s *PrepareSuite) TestPrepare_UpdatesVersionAndPromotesUnreleasedNotes() {
|
||||
|
||||
changelogBytes, err := os.ReadFile(filepath.Join(s.rootDir, "changelog.md"))
|
||||
require.NoError(s.T(), err)
|
||||
require.Equal(s.T(), "# Changelog\n\n## [Unreleased](https://git.hrafn.xyz/aether/vociferate/src/branch/main)\n\n## [1.1.7](https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.7) - 2026-03-20\n\n### Breaking\n\n### Added\n\n- New thing.\n\n### Fixed\n\n- Old thing.\n\n## [1.1.6](https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.6) - 2017-12-20\n\n### Fixed\n\n- Historical note.\n", string(changelogBytes))
|
||||
require.Equal(s.T(), "# Changelog\n\n## [Unreleased]\n\n## [1.1.7] - 2026-03-20\n\n### Breaking\n\n### Added\n\n- New thing.\n\n### Fixed\n\n- Old thing.\n\n## [1.1.6] - 2017-12-20\n\n### Fixed\n\n- Historical note.\n\n[Unreleased]: https://git.hrafn.xyz/aether/vociferate/src/branch/main\n[1.1.7]: https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.7\n[1.1.6]: https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.6\n", string(changelogBytes))
|
||||
}
|
||||
|
||||
func (s *PrepareSuite) TestPrepare_ReturnsErrorWhenUnreleasedSectionMissing() {
|
||||
@@ -244,9 +244,12 @@ func (s *PrepareSuite) TestPrepare_UsesGitHrafnXYZEnvironmentForChangelogLinks()
|
||||
require.NoError(s.T(), readErr)
|
||||
changelog := string(changelogBytes)
|
||||
|
||||
require.Contains(s.T(), changelog, "## [Unreleased](https://git.hrafn.xyz/aether/vociferate/src/branch/main)")
|
||||
require.Contains(s.T(), changelog, "## [1.1.7](https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.7) - 2026-03-20")
|
||||
require.Contains(s.T(), changelog, "## [1.1.6](https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.6) - 2017-12-20")
|
||||
require.Contains(s.T(), changelog, "## [Unreleased]\n")
|
||||
require.Contains(s.T(), changelog, "## [1.1.7] - 2026-03-20")
|
||||
require.Contains(s.T(), changelog, "## [1.1.6] - 2017-12-20")
|
||||
require.Contains(s.T(), changelog, "[Unreleased]: https://git.hrafn.xyz/aether/vociferate/src/branch/main")
|
||||
require.Contains(s.T(), changelog, "[1.1.7]: https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.7")
|
||||
require.Contains(s.T(), changelog, "[1.1.6]: https://git.hrafn.xyz/aether/vociferate/releases/tag/v1.1.6")
|
||||
}
|
||||
|
||||
func (s *PrepareSuite) TestPrepare_UsesGitHubEnvironmentForChangelogLinks() {
|
||||
@@ -260,7 +263,10 @@ func (s *PrepareSuite) TestPrepare_UsesGitHubEnvironmentForChangelogLinks() {
|
||||
require.NoError(s.T(), readErr)
|
||||
changelog := string(changelogBytes)
|
||||
|
||||
require.Contains(s.T(), changelog, "## [Unreleased](https://github.com/aether/vociferate/src/branch/main)")
|
||||
require.Contains(s.T(), changelog, "## [1.1.7](https://github.com/aether/vociferate/releases/tag/v1.1.7) - 2026-03-20")
|
||||
require.Contains(s.T(), changelog, "## [1.1.6](https://github.com/aether/vociferate/releases/tag/v1.1.6) - 2017-12-20")
|
||||
require.Contains(s.T(), changelog, "## [Unreleased]\n")
|
||||
require.Contains(s.T(), changelog, "## [1.1.7] - 2026-03-20")
|
||||
require.Contains(s.T(), changelog, "## [1.1.6] - 2017-12-20")
|
||||
require.Contains(s.T(), changelog, "[Unreleased]: https://github.com/aether/vociferate/src/branch/main")
|
||||
require.Contains(s.T(), changelog, "[1.1.7]: https://github.com/aether/vociferate/releases/tag/v1.1.7")
|
||||
require.Contains(s.T(), changelog, "[1.1.6]: https://github.com/aether/vociferate/releases/tag/v1.1.6")
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ runs:
|
||||
elif [[ "${GITHUB_REF_VALUE}" == refs/tags/* ]]; then
|
||||
tag="${GITHUB_REF_VALUE#refs/tags/}"
|
||||
normalized="${tag#v}"
|
||||
elif head_tag="$(git describe --exact-match --tags HEAD 2>/dev/null)" && [[ -n "$head_tag" ]]; then
|
||||
tag="$head_tag"
|
||||
normalized="${tag#v}"
|
||||
else
|
||||
echo "A version input is required when the workflow is not running from a tag push" >&2
|
||||
exit 1
|
||||
@@ -71,9 +74,9 @@ runs:
|
||||
set -euo pipefail
|
||||
|
||||
release_notes="$(awk -v version="$RELEASE_VERSION" '
|
||||
$0 ~ "^## \\[" version "\\] - " {capture=1}
|
||||
$0 ~ "^## \\[" version "\\]" {capture=1}
|
||||
capture {
|
||||
if ($0 ~ "^## \\[" && $0 !~ "^## \\[" version "\\] - ") exit
|
||||
if ($0 ~ "^## \\[" && $0 !~ "^## \\[" version "\\]") exit
|
||||
print
|
||||
}
|
||||
' "$CHANGELOG")"
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.0
|
||||
0.1.0
|
||||
|
||||
Reference in New Issue
Block a user