Package installer in releases and expand Renovate dependency updates
Release / release (push) Successful in 4m41s

This commit is contained in:
Sebastian Unterschütz committed 2026-10-27 18:38:54 +01:00
1 parent 66a49786c9
commit fa4509038b
8 files changed
+259 -16

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
package netssh_test
import (
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
)
func TestReleaseNotesUseReleaseAssetAndVersionRange(t *testing.T) {
script, err := filepath.Abs("scripts/release-notes.sh")
if err != nil {
t.Fatal(err)
}
repo := t.TempDir()
git := func(args ...string) {
t.Helper()
cmd := exec.Command("git", args...)
cmd.Dir = repo
cmd.Env = append(os.Environ(), "GIT_AUTHOR_NAME=Release Test", "GIT_AUTHOR_EMAIL=release@example.com", "GIT_COMMITTER_NAME=Release Test", "GIT_COMMITTER_EMAIL=release@example.com", "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null")
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("git %v: %v\n%s", args, err, out)
}
}
git("init")
git("-c", "commit.gpgsign=false", "commit", "--allow-empty", "-m", "Initial version")
git("tag", "v0.0.1")
render := func(tag string) string {
t.Helper()
cmd := exec.Command("bash", script, tag, "https://git.example.com/team/netssh/")
cmd.Dir = repo
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("render: %v\n%s", err, out)
}
return string(out)
}
initial := render("v0.0.1")
if !strings.Contains(initial, "Initial release:") || !strings.Contains(initial, "Initial version") {
t.Fatalf("first release: %s", initial)
}
git("-c", "commit.gpgsign=false", "commit", "--allow-empty", "-m", `Add installer and "quoted" release notes`)
git("tag", "v0.0.2")
git("-c", "commit.gpgsign=false", "commit", "--allow-empty", "-m", "Unreleased changes")
notes := render("v0.0.2")
for _, want := range []string{"https://git.example.com/team/netssh/releases/download/v0.0.2/install.sh", "Changes since `v0.0.1`:", `Add installer and "quoted" release notes`, "checksums.txt"} {
if !strings.Contains(notes, want) {
t.Errorf("missing %q:\n%s", want, notes)
}
}
for _, excluded := range []string{"Initial version", "Unreleased changes", "raw/branch/main"} {
if strings.Contains(notes, excluded) {
t.Errorf("unexpected %q:\n%s", excluded, notes)
}
}
}