mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-20 07:47:15 +09:00
Edit nightly release instead of replacing
This commit is contained in:
@@ -9,8 +9,7 @@ if [[ $info = *$commitID* ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Deleting old release"
|
||||
hub release delete nightly
|
||||
go run remove-nightly-assets.go
|
||||
|
||||
echo "Moving tag"
|
||||
hub push origin :refs/tags/nightly
|
||||
@@ -21,10 +20,12 @@ echo "Cross compiling binaries"
|
||||
./cross-compile.sh $1
|
||||
mv ../binaries .
|
||||
|
||||
MESSAGE=$'Nightly build\n\nAutogenerated nightly build of micro'
|
||||
|
||||
echo "Creating new release"
|
||||
hub release create nightly \
|
||||
hub release edit nightly \
|
||||
--prerelease \
|
||||
--message $'Nightly build\n\nAutogenerated nightly build of micro.' \
|
||||
--message "$MESSAGE. Assets uploaded on $(date)" \
|
||||
--attach "binaries/micro-$1-osx.tar.gz" \
|
||||
--attach "binaries/micro-$1-linux64.tar.gz" \
|
||||
--attach "binaries/micro-$1-linux64-static.tar.gz" \
|
||||
|
||||
39
tools/remove-nightly-assets.go
Normal file
39
tools/remove-nightly-assets.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/zyedidia/json5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
resp, err := http.Get("https://api.github.com/repos/zyedidia/micro/releases")
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
|
||||
var data interface{}
|
||||
|
||||
err = json5.Unmarshal(body, &data)
|
||||
|
||||
for _, val := range data.([]interface{}) {
|
||||
m := val.(map[string]interface{})
|
||||
releaseName := m["name"].(string)
|
||||
assets := m["assets"].([]interface{})
|
||||
for _, asset := range assets {
|
||||
assetInfo := asset.(map[string]interface{})
|
||||
url := assetInfo["url"].(string)
|
||||
if strings.Contains(strings.ToLower(releaseName), "nightly") {
|
||||
cmd := exec.Command("hub", "api", "-X", "DELETE", url)
|
||||
cmd.Run()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user