mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 04:45:15 +00:00
Update release script, add check for changelog/releases
This commit is contained in:
parent
85f9f3e290
commit
8d8456590c
@ -13,6 +13,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
@ -23,6 +24,7 @@ var opts = struct {
|
|||||||
IgnoreBranchName bool
|
IgnoreBranchName bool
|
||||||
IgnoreUncommittedChanges bool
|
IgnoreUncommittedChanges bool
|
||||||
IgnoreChangelogVersion bool
|
IgnoreChangelogVersion bool
|
||||||
|
IgnoreChangelogRelease bool
|
||||||
IgnoreChangelogCurrent bool
|
IgnoreChangelogCurrent bool
|
||||||
|
|
||||||
tarFilename string
|
tarFilename string
|
||||||
@ -35,6 +37,7 @@ 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-changelog-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.IgnoreChangelogRelease, "ignore-changelog-releases", false, "ignore missing entry changelog/releases")
|
||||||
pflag.BoolVar(&opts.IgnoreChangelogCurrent, "ignore-changelog-current", false, "ignore check if CHANGELOG.md is up to date")
|
pflag.BoolVar(&opts.IgnoreChangelogCurrent, "ignore-changelog-current", false, "ignore check if CHANGELOG.md is up to date")
|
||||||
pflag.Parse()
|
pflag.Parse()
|
||||||
}
|
}
|
||||||
@ -168,6 +171,35 @@ func preCheckChangelogCurrent() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func preCheckChangelogRelease() {
|
||||||
|
if opts.IgnoreChangelogRelease {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
f, err := os.Open(filepath.FromSlash("changelog/releases"))
|
||||||
|
if err != nil {
|
||||||
|
die("unable to open releases file in changelog/: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sc := bufio.NewScanner(f)
|
||||||
|
for sc.Scan() {
|
||||||
|
if sc.Err() != nil {
|
||||||
|
die("error reading releases file in changelog: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if sc.Text() == fmt.Sprintf("%v %v", opts.Version, time.Now().Format("2006-01-02")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = f.Close()
|
||||||
|
if err != nil {
|
||||||
|
die("close releases error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
die("unable to find correct line for version %v (released today) in changelog/releases", opts.Version)
|
||||||
|
}
|
||||||
|
|
||||||
func preCheckChangelogVersion() {
|
func preCheckChangelogVersion() {
|
||||||
if opts.IgnoreChangelogVersion {
|
if opts.IgnoreChangelogVersion {
|
||||||
return
|
return
|
||||||
@ -306,6 +338,7 @@ func main() {
|
|||||||
preCheckUncommittedChanges()
|
preCheckUncommittedChanges()
|
||||||
preCheckVersionExists()
|
preCheckVersionExists()
|
||||||
preCheckChangelogCurrent()
|
preCheckChangelogCurrent()
|
||||||
|
preCheckChangelogRelease()
|
||||||
preCheckChangelogVersion()
|
preCheckChangelogVersion()
|
||||||
|
|
||||||
generateFiles()
|
generateFiles()
|
||||||
|
Loading…
Reference in New Issue
Block a user