57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"strings"
|
|
)
|
|
|
|
// attempts a simple release
|
|
// merge user branch -> devel; then;
|
|
// git push
|
|
// merge devel branch -> master; then;
|
|
// git push
|
|
|
|
// increments the minor version by 1; then;
|
|
// git push --tags
|
|
|
|
func simpleRelease(w http.ResponseWriter, r *http.Request) {
|
|
repoName := r.URL.Query().Get("repo")
|
|
if repoName == "" {
|
|
msg(w, "url did not have repo variable")
|
|
return
|
|
}
|
|
// git pull (or go-clone of it doesn't exist)
|
|
repo := me.repos.View.FindRepoByName(repoName)
|
|
if repo == nil {
|
|
msg(w, "repo unknown: "+repoName)
|
|
return
|
|
}
|
|
header := repo.StandardHeader()
|
|
if repo.CheckDirty() {
|
|
msg(w, header+"skip dirty repo")
|
|
return
|
|
}
|
|
if repo.State() == "PERFECT" {
|
|
msg(w, header+"already released")
|
|
return
|
|
}
|
|
|
|
curName := repo.Status.GetCurrentBranchName()
|
|
mName := repo.Status.GetMasterBranchName()
|
|
if curName != mName {
|
|
// s := log.Sprintf("\trepo is not working from main branch", curName, "!=", mName)
|
|
s := fmt.Sprint("repo is not working from main branch ", curName, " != ", mName)
|
|
msg(w, s)
|
|
return
|
|
}
|
|
cmd := []string{"git", "pull", "-v"}
|
|
msg(w, header+strings.Join(cmd, " "))
|
|
if repo.Status.MergeUserToDevel() {
|
|
msg(w, "THINGS SEEM OK MergeUserToDevel() returned true.")
|
|
} else {
|
|
msg(w, "THINGS FAILED MergeUserToDevel() returned false")
|
|
}
|
|
return
|
|
}
|