File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ die () {
4
+ echo " $* " >&2
5
+ exit 1
6
+ }
7
+
8
+ test $# -ge 2 ||
9
+ die " Usage: $0 <tag-name> <path>..."
10
+
11
+ tagname=" $1 "
12
+ shift
13
+
14
+ url=https://api.github.com/repos/msysgit/msysgit/releases
15
+ id=" $( curl --netrc -s $url |
16
+ grep -B1 " \" tag_name\" : \" $tagname \" " |
17
+ sed -n ' s/.*"id": *\([0-9]*\).*/\1/p' ) "
18
+ test -n " $id " || {
19
+ out=" $( curl --netrc -s -XPOST -d ' {"tag_name":"' " $tagname " ' "}' $url ) " ||
20
+ die " Error creating release: $out "
21
+ id=" $( echo " $out " |
22
+ sed -n ' s/.*"id": *\([0-9]*\).*/\1/p' ) "
23
+ test -n " $id " ||
24
+ die " Could not create release for tag $tagname "
25
+ }
26
+
27
+ url=https://uploads.${url# https:// api.}
28
+
29
+ for path
30
+ do
31
+ case " $path " in
32
+ * .exe)
33
+ contenttype=application/executable
34
+ ;;
35
+ * .7z)
36
+ contenttype=application/zip
37
+ ;;
38
+ * )
39
+ die " Unknown file type: $path "
40
+ ;;
41
+ esac
42
+ basename=" $( basename " $path " ) "
43
+ curl -i --netrc -XPOST -H " Content-Type: $contenttype " \
44
+ --data-binary @" $path " " $url /$id /assets?name=$basename "
45
+ done
You can’t perform that action at this time.
0 commit comments