This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
create_release.sh
executable file
·61 lines (47 loc) · 1.77 KB
/
create_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
# shellcheck disable=SC1091
source build_framework.sh
function create_release() {
local CRONET_VERSION=$1
local BRANCH_NAME=$2
if [ -z "$CRONET_VERSION" ]; then
echo "Empty cronet version. Check passed in argument"
return 1
fi
if [ -z "$BRANCH_NAME" ]; then
echo "Empty branch name. Check passed in argument"
return 1
fi
local CURRENT_BRANCH_NAME
CURRENT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
git checkout -b "$BRANCH_NAME"
build_framework "$CRONET_VERSION"
sed -i "" "s/MASTER_BRANCH/$BRANCH_NAME/" Cronet.podspec
git add .
git commit -m "Build $BRANCH_NAME"
git tag "v$BRANCH_NAME"
git push origin "$BRANCH_NAME"
git push origin --tags
if [[ $BRANCH_NAME == *"dev" || $BRANCH_NAME == *"beta" ]]; then
hub release create --draft=false -p -a Cronet-Static.framework.tar.bz2 -a Cronet-Dynamic.framework.tar.bz2 -a Cronet.framework.dSYM.tar.bz2 -m "$BRANCH_NAME" "v$BRANCH_NAME"
else
hub release create --draft=false -a Cronet-Static.framework.tar.bz2 -a Cronet-Dynamic.framework.tar.bz2 -a Cronet.framework.dSYM.tar.bz2 -m "$BRANCH_NAME" "v$BRANCH_NAME"
fi
git checkout "$CURRENT_BRANCH_NAME"
}
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
export -f create_release
else
# Exit on error. Append "|| true" if you expect an error.
set -o errexit
# Exit on error inside any functions or subshells.
set -o errtrace
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
set -o nounset
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
set -o pipefail
# Turn on traces, useful while debugging but commented out by default
# set -o xtrace
create_release "${@}"
exit $?
fi