Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/bash
# This is an automated script for TravisCI
# It is triggered on push to master
# It will create a release and publish to the github repo
OWNER=HumanBrainProject
REPO=interactive-viewer
USER=xgui3783
EMAIL=xgui3783@gmail.com
#GITHUB_TOKEN should be populated by CI
test -z "$GITHUB_TOKEN" && exit 1
TAG=$(jq '.version' < package.json)
TAG=${TAG#\"}
TAG=v${TAG%\"}
OBJECT=$(git rev-parse HEAD)
DATE=$(date --iso-8601=seconds)
BODY='{
"tag": "'$TAG'",
"message": "Annotated release for '$TAG'",
"object": "'$OBJECT'",
"type": "commit",
"tagger": {
"name": "'$USER'",
"email": "'$EMAIL'",
"date": "'$DATE'"
}
}'
# Create annotated tag
echo curl -XPOST \
-H "Accept: application/vnd.github.v3+json" \
-u "$USER:$GITHUB_TOKEN"\
-d "$BODY" \
https://api.github.com/repos/$OWNER/$REPO/git/tags
# Push tag to remote
CREATE_REF_BODY='{
"ref":"refs/tags/'$TAG'",
"sha":"'$OBJECT'"
}'
echo curl -XPOST\
-u "$USER:$GITHUB_TOKEN"\
-H "Accept: application/vnd.github.v3+json" \
-d "$CREATE_REF_BODY"\
https://api.github.com/repos/$OWNER/$REPO/git/refs
# Create release
RELEASE_NOTES=$(sed -e 's/$/\\n/' docs/releases/$TAG.md)
RELEASE_BODY='{
"tag_name":"'$TAG'",
"name":"'$TAG'",
"body":"'$(echo $RELEASE_NOTES)'",
"target_commitish": "master",
"draft":false,
"prerelease":false
}'
echo curl -XPOST\
-u "$USER:$GITHUB_TOKEN"\
-H "Accept: application/vnd.github.v3+json" \
-d "$RELEASE_BODY" \
https://api.github.com/repos/$OWNER/$REPO/releases