-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtag_release.sh
executable file
·79 lines (63 loc) · 1.51 KB
/
tag_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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: $0 app_name"
exit 1
fi
app="$1"
proj="Hemlock.xcodeproj/project.pbxproj"
set -e
## find the plist identifier of the XCBuildConfiguration Release section for the given app
buildver=$(cat "$proj" \
| sed -ne '/Begin XCBuildConfiguration section/,/End XCBuildConfiguration section/ p' \
| awk '
BEGIN {
app_matches = 0
}
# Store the identifier of Debug or Release blocks
/[A-F0-9]+ \/\* (Debug|Release) \*\// {
IDENT = $1
#print NR, $0
}
# If the app matches, we are in the right block
/INFOPLIST_FILE.*\/'$app'_app/ {
#print NR, $0
#print IDENT
app_matches = 1
}
# Get out at the end of the match block
/};/ {
if (app_matches) {
#print NR, $0
exit
}
}
# Extract BUILD (includes semicolon)
/CURRENT_PROJECT_VERSION = / {
BUILD = $3
}
# Extract VERSION (includes semicolon)
/MARKETING_VERSION = / {
VERSION = $3
}
END {
if (app_matches) {
print "BUILD=" BUILD
print "VERSION=" VERSION
} else {
print "false"
}
}
')
echo "$buildver"
eval "$buildver" || { echo >&2 failed to parse BUILD and VERSION; exit 1; }
test -n "$BUILD"
test -n "$VERSION"
## Construct a tag and tag it
set -ex
tag=${app}_${VERSION}.${BUILD}
msg="${tag}"
git commit "$proj" -m "$msg" || true
git tag -a -m "$msg" $tag
git push
#git push --tags
git push origin $tag