diff --git a/release.go b/release.go index 789ee4f..a2dc804 100644 --- a/release.go +++ b/release.go @@ -35,16 +35,24 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) { if newImages { // delete old firmware files in public folder - for _, file := range check_tDir { - if !(dryrun) { - err := os.RemoveAll(tDir + file.Name()) - if err != nil { - log.Println("error deleting file: ", err) + // if we are in stable branch, move images to archive + if b == "stable" { + err := os.Rename(tDir+"/"+b, tDir+"/archive/v") + if err != nil { + log.Fatalln(err) + } + } else { + for _, file := range check_tDir { + if !(dryrun) { + err := os.RemoveAll(tDir + file.Name()) + if err != nil { + log.Println("error deleting file: ", err) + } else { + log.Println("removed file: ", file.Name()) + } } else { - log.Println("removed file: ", file.Name()) + log.Println("DRYRUN: delete folder :", file.Name()) } - } else { - log.Println("DRYRUN: delete folder :", file.Name()) } }