Added target version
This commit is contained in:
parent
7029d039a3
commit
8d77819f57
5
main.go
5
main.go
@ -13,14 +13,13 @@ func main() {
|
|||||||
var source_dir = flag.String("s", "", "Path to image folder (/srv/fwuploads-tmp/)")
|
var source_dir = flag.String("s", "", "Path to image folder (/srv/fwuploads-tmp/)")
|
||||||
var target_dir = flag.String("t", "", "Path to image folder in public (/srv/fwuploads/troisdorf)")
|
var target_dir = flag.String("t", "", "Path to image folder in public (/srv/fwuploads/troisdorf)")
|
||||||
var branch = flag.String("b", "", "Branch to work with")
|
var branch = flag.String("b", "", "Branch to work with")
|
||||||
var version = flag.String("v", "", "which version should be released")
|
|
||||||
var dryrun = flag.Bool("d", false, "Dryrun, just show changes on filesystem")
|
var dryrun = flag.Bool("d", false, "Dryrun, just show changes on filesystem")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
sdir := *source_dir
|
sdir := *source_dir
|
||||||
tdir := *target_dir
|
tdir := *target_dir
|
||||||
br := *branch
|
br := *branch
|
||||||
|
version := readVersions(*branch)
|
||||||
var source_dir_branch string = sdir + br + "/images/"
|
var source_dir_branch string = sdir + br + "/images/"
|
||||||
var target_dir_branch string = tdir + br + "/images/"
|
var target_dir_branch string = tdir + br + "/images/"
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ func main() {
|
|||||||
log.Println("Error generating Manifest file: ", err)
|
log.Println("Error generating Manifest file: ", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
release_branch(*branch, source_dir_branch, target_dir_branch, *dryrun, *version)
|
release_branch(*branch, source_dir_branch, target_dir_branch, *dryrun, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ func split_filenames(files []fs.FileInfo, dir string) []Files {
|
|||||||
func build_manifest(files []Files, dir string) error {
|
func build_manifest(files []Files, dir string) error {
|
||||||
// Datei zum Schreiben öffnen
|
// Datei zum Schreiben öffnen
|
||||||
release := strings.Split(files[0].Release, "-")
|
release := strings.Split(files[0].Release, "-")
|
||||||
file, err := os.Create(dir + release[0] + ".manifest")
|
file, err := os.Create(dir + release[1] + ".manifest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("error creating manifest file")
|
fmt.Println("error creating manifest file")
|
||||||
return err
|
return err
|
||||||
@ -72,7 +72,7 @@ func build_manifest(files []Files, dir string) error {
|
|||||||
// Datum im gewünschten Format formatieren
|
// Datum im gewünschten Format formatieren
|
||||||
formatted := now.Format("2006-01-02 15:04:05-07:00")
|
formatted := now.Format("2006-01-02 15:04:05-07:00")
|
||||||
|
|
||||||
branch_line := "BRANCH=" + release[0] + "\n"
|
branch_line := "BRANCH=" + release[1] + "\n"
|
||||||
date_line := "DATE=" + formatted + "\n"
|
date_line := "DATE=" + formatted + "\n"
|
||||||
prio_line := "PRIORITY=0" + "\n"
|
prio_line := "PRIORITY=0" + "\n"
|
||||||
|
|
||||||
@ -104,6 +104,6 @@ func build_manifest(files []Files, dir string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Println("Manifest file " + release[0] + ".manifest" + " generated")
|
log.Println("Manifest file " + release[1] + ".manifest" + " generated")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
25
release.go
25
release.go
@ -1,7 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -73,6 +75,25 @@ func GetGluonVersion(path string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func check_Release() {
|
func readVersions(branch string) string {
|
||||||
|
filePath := "release_state.json"
|
||||||
|
v, err := ioutil.ReadFile(filePath)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln("Error reading version JSON file!")
|
||||||
|
}
|
||||||
|
|
||||||
|
var data Versions
|
||||||
|
err = json.Unmarshal(v, &data)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln("Error in JSON data!")
|
||||||
|
}
|
||||||
|
switch branch {
|
||||||
|
case "stable":
|
||||||
|
return data.Stable
|
||||||
|
case "beta":
|
||||||
|
return data.Beta
|
||||||
|
case "experimental":
|
||||||
|
return data.Experimental
|
||||||
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
5
release_state.json
Normal file
5
release_state.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"stable": "v2022.1.4",
|
||||||
|
"beta": "v2022.1.5",
|
||||||
|
"experimental": "v2022.1.4"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user