-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·88 lines (64 loc) · 2.32 KB
/
release.sh
File metadata and controls
executable file
·88 lines (64 loc) · 2.32 KB
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
80
81
82
83
84
85
86
87
#!/bin/bash
set -eo pipefail
# run from the KTRules directory
cd "${BASH_SOURCE%/*}/" || exit
KTMANAGERAPP_REPO="../KTManagerApp"
if output=$(git status --porcelain) && [[ ! -z "$output" ]]; then
# uncommitted changes
echo "Uncommitted changes, aborting" 1>&2
exit 1
fi
# get caught up
git fetch
echo # breathing room
develop_version=$(git show origin/develop:src/version.txt)
master_version=$(git show origin/master:src/version.txt)
echo "origin/master: $master_version"
echo "origin/develop: $develop_version"
if [[ "$develop_version" == "$master_version" ]]; then
echo "Master and develop are at the same version, change the develop version before releasing" 1>&2
exit 2
fi
# get user confirmation
echo -e "\nAbout to release the following commits as version $develop_version:\n"
git log origin/master..origin/develop --oneline
echo # give the log some room to breathe
read -p "Is this the version you want to release? [y/n]: " -n 1 -r
echo # move to new line
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
echo "User aborted" 2>&1
exit 2
fi
echo -e "\nGo make a pull request merging develop into master (but don't merge it!) and then come back here\n"
read -n 1 -s -r -p "Press any key to continue"
echo -e "\n\nUpdating master now"
git checkout master
git merge --ff-only origin/develop
read -p "Merge Done. Ready to push? [y/n]: " -n 1 -r
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
echo "User aborted" 2>&1
exit 2
fi
git push
echo -e "\nNow go close that pull request, it should show that it's already been merged."
read -n 1 -s -r -p "Press any key to continue"
read -p "Ready to export to KTManagerApp ($KTMANAGERAPP_REPO)? [y/n]: " -n 1 -r
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
echo "User aborted" 2>&1
exit 2
fi
# do a build
./build.py clean release
branch_name="rules-v$develop_version"
# go to the KTManagerApp repo and set up a new clean branch
cd "$KTMANAGERAPP_REPO"
git checkout -b "$branch_name" develop
cd -
# copy over the rules
cp -r out/* "$KTMANAGERAPP_REPO/KillTeam/SharedAssets/Rules"
find "$KTMANAGERAPP_REPO/KillTeam/SharedAssets/Rules" -type f -print0 | xargs -0 unix2dos
# go make a commit
cd "$KTMANAGERAPP_REPO"
git status
echo -e "\nCopied over, make sure everything works then commit and push"
echo -e "\nNOTE: if you added any new files, you need to add them as embedded resources in Visual Studio"