forked from raiden-network/raiden
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_poc_release.sh
executable file
·61 lines (39 loc) · 1.77 KB
/
prepare_poc_release.sh
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
#!/usr/bin/env bash
set -e
echo "Creating a release branch"
NEW_VERSION=$(bumpversion patch --dry-run --verbose 2>&1|grep current_version|tail -n1|cut -d' ' -f3)
RELEASE_BRANCH="poc_release_$NEW_VERSION"
echo "Will create $NEW_VERSION on $RELEASE_BRANCH"
git checkout -b $RELEASE_BRANCH
echo "Bumping the version"
bumpversion patch
git push --set-upstream [email protected]:raiden-network/raiden.git $RELEASE_BRANCH
echo "Querying your github user"
GH_USER=$(ssh [email protected] 2>&1|grep "Hi"|cut -d' ' -f2|rev|cut --complement -b-1|rev)
echo "Your github user seems to be $GH_USER"
read -s -p "Enter github password for $GH_USER: " GH_PASSWORD
# github doesn't issue OTP for all API requests, but this request works:
curl -u $GH_USER:$GH_PASSWORD https://api.github.com/authorizations -d '{
"scopes": ["invalid"],
"note": "just query OTP"
}'
read -s -p "Enter your github one time password: " GH_OTP
echo "\nCreating a pull request"
RESULT=$(curl -u $GH_USER:$GH_PASSWORD -XPOST -H "X-GitHub-OTP: $GH_OTP" \
https://api.github.com/repos/raiden-network/raiden/pulls -d'{
"title": "Release '"$NEW_VERSION"'",
"body": "automated PR!",
"base": "master",
"head": "'"$RELEASE_BRANCH"'"
}')
echo $RESULT
echo "--^ This should have created a pull request titled '$RELEASE_BRANCH'."
echo "If there is no PR, you should rollback your changes and start over."
GH_OTP=""
PR_URL=$(echo $RESULT|cut -d' ' -f 3|cut -b2-|rev|cut -b3-|rev)
# https://developer.github.com/early-access/platform-roadmap/ # see Pull Request Review REST API
echo "Since approving PRs is not supported yet, you have to proceed manually from here:"
echo "1) Get $PR_URL approved & merged"
echo "2) 'git checkout master && git pull --rebase'"
echo "3) 'git tag v$NEW_VERSION'"
echo "4) 'git push --tags'"