forked from massive-oss/haxe-react
-
Notifications
You must be signed in to change notification settings - Fork 5
/
tagRelease.sh
executable file
·48 lines (42 loc) · 1.06 KB
/
tagRelease.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
#!/bin/sh
set -e
VERSION=$1
MESSAGE=$2
# Validate version
if [ -z "$VERSION" ]; then
echo "No version specified"
exit 1
fi
if [ $(git tag -l "$VERSION") ]; then
echo "Tag $VERSION already exists"
exit 1
fi
if [ -z "$MESSAGE" ]; then
MESSAGE=""
else
MESSAGE=" - $MESSAGE"
fi
# Change version in haxelib.json and package.json
echo "Update version to $VERSION"
PATTERN="s/\"version\": \"[0-9]+.[0-9]+.[0-9]+\"/\"version\": \"$VERSION\"/g"
EXTRA_PATTERN="s/-D react=[0-9]+.[0-9]+.[0-9]+/-D react=$VERSION/g"
case "$(uname -s)" in
Darwin)
sed -E -i "" "$PATTERN" ./haxelib.json
sed -E -i "" "$PATTERN" ./mdk/info.json
sed -E -i "" "$EXTRA_PATTERN" ./extraParams.hxml
;;
*)
sed -E -i "$PATTERN" ./haxelib.json
sed -E -i "$PATTERN" ./mdk/info.json
sed -E -i "$EXTRA_PATTERN" ./extraParams.hxml
;;
esac
# Tag, commit and push to trigger a new CI release
git add ./haxelib.json
git add ./mdk/info.json
git add ./extraParams.hxml
git commit -m "$VERSION$MESSAGE"
git push fork next
git tag $VERSION
git push fork $VERSION