Compare commits
No commits in common. "main" and "v0.1.4" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
target*
|
target*
|
||||||
source*
|
source*
|
||||||
go-gluon-publish
|
|
||||||
|
2
main.go
2
main.go
@ -21,7 +21,7 @@ func main() {
|
|||||||
br := *branch
|
br := *branch
|
||||||
version := readVersions(*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
|
var target_dir_branch string = tdir + br + "/images/"
|
||||||
|
|
||||||
if is_firmware_folder(source_dir_branch) {
|
if is_firmware_folder(source_dir_branch) {
|
||||||
//generate manifest file for branch
|
//generate manifest file for branch
|
||||||
|
45
release.go
45
release.go
@ -19,40 +19,27 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) {
|
|||||||
}
|
}
|
||||||
sVersion := GetGluonVersion(sDir)
|
sVersion := GetGluonVersion(sDir)
|
||||||
tVersion := GetGluonVersion(tDir)
|
tVersion := GetGluonVersion(tDir)
|
||||||
fmt.Println("Target Version:", b, tVersion)
|
|
||||||
fmt.Println("Source Version:", b, sVersion)
|
|
||||||
fmt.Println("Wanted Version:", b, v)
|
|
||||||
//check wanted version in target
|
//check wanted version in target
|
||||||
if tVersion == v {
|
if tVersion != v {
|
||||||
log.Println(b, "wanted version is already published!")
|
log.Println("published version is outdated, try to update from source folder")
|
||||||
os.Exit(0)
|
if sVersion != v {
|
||||||
}
|
log.Println("wanted Version is not availible in source folder")
|
||||||
log.Println(b, "published version is outdated, try to update from source folder")
|
os.Exit(1)
|
||||||
if sVersion != v {
|
}
|
||||||
log.Println(b, "wanted Version is not availible in source folder")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if newImages {
|
if newImages {
|
||||||
// delete old firmware files in public folder
|
// delete old firmware files in public folder
|
||||||
// if we are in stable branch, move images to archive
|
for _, file := range check_tDir {
|
||||||
if b == "stable" {
|
if !(dryrun) {
|
||||||
err := os.Rename(tDir+"/*", tDir+"/archive/"+v)
|
err := os.RemoveAll(tDir + file.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Println("error deleting file: ", 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("DRYRUN: delete folder :", file.Name())
|
log.Println("removed file: ", file.Name())
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Println("DRYRUN: delete folder :", file.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +56,7 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetGluonVersion(path string) string {
|
func GetGluonVersion(path string) string {
|
||||||
image_folder := path + "/sysupgrade/"
|
image_folder := path + "sysupgrade/"
|
||||||
files, err := filepath.Glob(filepath.Join(image_folder, "gluon-tdf-*"))
|
files, err := filepath.Glob(filepath.Join(image_folder, "gluon-tdf-*"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error reading directory: ", err)
|
fmt.Println("Error reading directory: ", err)
|
||||||
@ -89,7 +76,7 @@ func GetGluonVersion(path string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readVersions(branch string) string {
|
func readVersions(branch string) string {
|
||||||
filePath := "/srv/fwuploads-tmp/bin/release_state.json"
|
filePath := "release_state.json"
|
||||||
v, err := ioutil.ReadFile(filePath)
|
v, err := ioutil.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("Error reading version JSON file!")
|
log.Fatalln("Error reading version JSON file!")
|
||||||
|
Loading…
Reference in New Issue
Block a user