2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-24 21:57:41 +00:00

helpers: Remove old changelog files for release

This commit is contained in:
Alexander Neumann 2020-11-05 10:26:00 +01:00
parent 4e3ad8b3b1
commit 8a0dbe7c1a

View File

@ -203,16 +203,17 @@ func preCheckChangelogRelease() bool {
func createChangelogRelease() {
date := time.Now().Format("2006-01-02")
target := filepath.Join("changelog", fmt.Sprintf("%s_%s", opts.Version, date))
mkdir(target)
targetDir := filepath.Join("changelog", fmt.Sprintf("%s_%s", opts.Version, date))
unreleasedDir := filepath.Join("changelog", "unreleased")
mkdir(targetDir)
for _, name := range readdir(filepath.Join("changelog", "unreleased")) {
for _, name := range readdir(unreleasedDir) {
if name == ".gitignore" {
continue
}
src := filepath.Join("changelog", "unreleased", name)
dest := filepath.Join(target, name)
dest := filepath.Join(targetDir, name)
err := os.Rename(src, dest)
if err != nil {
@ -220,11 +221,11 @@ func createChangelogRelease() {
}
}
run("git", "add", target)
run("git", "add", "-u", filepath.Join("changelog", "unreleased"))
run("git", "add", targetDir)
run("git", "add", "-u", unreleasedDir)
msg := fmt.Sprintf("Prepare changelog for %v", opts.Version)
run("git", "commit", "-m", msg, target)
run("git", "commit", "-m", msg, targetDir, unreleasedDir)
}
func preCheckChangelogVersion() {