Browse Source

deploy a specific branch

Morgan Bazalgette 1 year ago
parent
commit
5d21f2122f
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      startuato_linux.go

+ 10
- 1
startuato_linux.go View File

@@ -103,9 +103,18 @@ func updateFromRemote(c *gin.Context) {
103 103
 		c.String(500, "not git ffs")
104 104
 		return
105 105
 	}
106
+
107
+	br := c.Query("branch")
108
+	if br == "" {
109
+		br = "master"
110
+	}
111
+
106 112
 	c.String(200, "all right")
107 113
 	go func() {
108
-		if !execCommand("git", "pull", "origin", "master") {
114
+		if !execCommand("git", "fetch", "origin", br) {
115
+			return
116
+		}
117
+		if !execCommand("git", "checkout", "origin/"+br) {
109 118
 			return
110 119
 		}
111 120
 		if !execCommand("git", "submodule", "update") {

Loading…
Cancel
Save