move images to archive if stable
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Stefan Hoffmann 2023-07-30 20:49:32 +02:00
parent b87065b548
commit 72430a2d8e
Signed by: stefan
GPG Key ID: 8EFC7042BF8D5CDD

View File

@ -35,16 +35,24 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) {
if newImages { if newImages {
// delete old firmware files in public folder // delete old firmware files in public folder
for _, file := range check_tDir { // if we are in stable branch, move images to archive
if !(dryrun) { if b == "stable" {
err := os.RemoveAll(tDir + file.Name()) err := os.Rename(tDir+"/"+b, tDir+"/archive/v")
if err != nil { if err != nil {
log.Println("error deleting file: ", err) 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 { } else {
log.Println("removed file: ", file.Name()) log.Println("DRYRUN: delete folder :", file.Name())
} }
} else {
log.Println("DRYRUN: delete folder :", file.Name())
} }
} }