From 72430a2d8eb62db4ed98c37dd56bb499abba66a0 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 30 Jul 2023 20:49:32 +0200 Subject: [PATCH] move images to archive if stable --- release.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) 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()) } }