mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
Add changelog generation to release script
This commit is contained in:
parent
af27f1dde5
commit
e03cc81a9a
1 changed files with 23 additions and 4 deletions
|
@ -23,6 +23,7 @@ var opts = struct {
|
||||||
IgnoreBranchName bool
|
IgnoreBranchName bool
|
||||||
IgnoreUncommittedChanges bool
|
IgnoreUncommittedChanges bool
|
||||||
IgnoreChangelogVersion bool
|
IgnoreChangelogVersion bool
|
||||||
|
IgnoreChangelogCurrent bool
|
||||||
|
|
||||||
tarFilename string
|
tarFilename string
|
||||||
buildDir string
|
buildDir string
|
||||||
|
@ -33,7 +34,8 @@ var versionRegex = regexp.MustCompile(`^\d+\.\d+\.\d+$`)
|
||||||
func init() {
|
func init() {
|
||||||
pflag.BoolVar(&opts.IgnoreBranchName, "ignore-branch-name", false, "allow releasing from other branches as 'master'")
|
pflag.BoolVar(&opts.IgnoreBranchName, "ignore-branch-name", false, "allow releasing from other branches as 'master'")
|
||||||
pflag.BoolVar(&opts.IgnoreUncommittedChanges, "ignore-uncommitted-changes", false, "allow uncommitted changes")
|
pflag.BoolVar(&opts.IgnoreUncommittedChanges, "ignore-uncommitted-changes", false, "allow uncommitted changes")
|
||||||
pflag.BoolVar(&opts.IgnoreChangelogVersion, "ignore-changelgo-version", false, "ignore missing entry in CHANGELOG.md")
|
pflag.BoolVar(&opts.IgnoreChangelogVersion, "ignore-changelog-version", false, "ignore missing entry in CHANGELOG.md")
|
||||||
|
pflag.BoolVar(&opts.IgnoreChangelogCurrent, "ignore-changelog-current", false, "ignore check if CHANGELOG.md is up to date")
|
||||||
pflag.Parse()
|
pflag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +153,22 @@ func preCheckVersionExists() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func preCheckChangelog() {
|
func preCheckChangelogCurrent() {
|
||||||
|
if opts.IgnoreChangelogCurrent {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// regenerate changelog
|
||||||
|
run("calens", "--output", "CHANGELOG.md")
|
||||||
|
|
||||||
|
// check for uncommitted changes in changelog
|
||||||
|
if len(uncommittedChanges("CHANGELOG.md")) > 0 {
|
||||||
|
msg("committing file CHANGELOG.md")
|
||||||
|
run("git", "commit", "-m", fmt.Sprintf("Generate CHANGELOG.md for %v", opts.Version), "CHANGELOG.md")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func preCheckChangelogVersion() {
|
||||||
if opts.IgnoreChangelogVersion {
|
if opts.IgnoreChangelogVersion {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -168,7 +185,7 @@ func preCheckChangelog() {
|
||||||
die("error scanning: %v", sc.Err())
|
die("error scanning: %v", sc.Err())
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.TrimSpace(sc.Text()) == fmt.Sprintf("Important Changes in %v", opts.Version) {
|
if strings.Contains(strings.TrimSpace(sc.Text()), fmt.Sprintf("Changelog for restic %v", opts.Version)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,6 +206,7 @@ func generateFiles() {
|
||||||
"--bash-completion", "doc/bash-completion.sh")
|
"--bash-completion", "doc/bash-completion.sh")
|
||||||
rm("restic-generate.temp")
|
rm("restic-generate.temp")
|
||||||
|
|
||||||
|
run("git", "add", "doc")
|
||||||
changes := uncommittedChanges("doc")
|
changes := uncommittedChanges("doc")
|
||||||
if len(changes) > 0 {
|
if len(changes) > 0 {
|
||||||
msg("committing manpages and auto-completion")
|
msg("committing manpages and auto-completion")
|
||||||
|
@ -287,7 +305,8 @@ func main() {
|
||||||
preCheckBranchMaster()
|
preCheckBranchMaster()
|
||||||
preCheckUncommittedChanges()
|
preCheckUncommittedChanges()
|
||||||
preCheckVersionExists()
|
preCheckVersionExists()
|
||||||
preCheckChangelog()
|
preCheckChangelogCurrent()
|
||||||
|
preCheckChangelogVersion()
|
||||||
|
|
||||||
generateFiles()
|
generateFiles()
|
||||||
updateVersion()
|
updateVersion()
|
||||||
|
|
Loading…
Reference in a new issue