mirror of
https://github.com/octoleo/restic.git
synced 2024-11-28 15:56:37 +00:00
helpers: Remove old changelog files for release
This commit is contained in:
parent
4e3ad8b3b1
commit
8a0dbe7c1a
@ -203,16 +203,17 @@ func preCheckChangelogRelease() bool {
|
|||||||
|
|
||||||
func createChangelogRelease() {
|
func createChangelogRelease() {
|
||||||
date := time.Now().Format("2006-01-02")
|
date := time.Now().Format("2006-01-02")
|
||||||
target := filepath.Join("changelog", fmt.Sprintf("%s_%s", opts.Version, date))
|
targetDir := filepath.Join("changelog", fmt.Sprintf("%s_%s", opts.Version, date))
|
||||||
mkdir(target)
|
unreleasedDir := filepath.Join("changelog", "unreleased")
|
||||||
|
mkdir(targetDir)
|
||||||
|
|
||||||
for _, name := range readdir(filepath.Join("changelog", "unreleased")) {
|
for _, name := range readdir(unreleasedDir) {
|
||||||
if name == ".gitignore" {
|
if name == ".gitignore" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
src := filepath.Join("changelog", "unreleased", name)
|
src := filepath.Join("changelog", "unreleased", name)
|
||||||
dest := filepath.Join(target, name)
|
dest := filepath.Join(targetDir, name)
|
||||||
|
|
||||||
err := os.Rename(src, dest)
|
err := os.Rename(src, dest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -220,11 +221,11 @@ func createChangelogRelease() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run("git", "add", target)
|
run("git", "add", targetDir)
|
||||||
run("git", "add", "-u", filepath.Join("changelog", "unreleased"))
|
run("git", "add", "-u", unreleasedDir)
|
||||||
|
|
||||||
msg := fmt.Sprintf("Prepare changelog for %v", opts.Version)
|
msg := fmt.Sprintf("Prepare changelog for %v", opts.Version)
|
||||||
run("git", "commit", "-m", msg, target)
|
run("git", "commit", "-m", msg, targetDir, unreleasedDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
func preCheckChangelogVersion() {
|
func preCheckChangelogVersion() {
|
||||||
|
Loading…
Reference in New Issue
Block a user