-
Notifications
You must be signed in to change notification settings - Fork 10
/
release
executable file
·37 lines (29 loc) · 1004 Bytes
/
release
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
#!/usr/bin/env bash
function fail {
echo "$@"
exit 1
}
test -n "$1" || fail "usage: $0 <release number>"
echo "$1" | grep -q '^[0-9]\+\.[0-9]\+\.[0-9]\+$' || fail "Release number should be in the format X.Y.Z"
cd `dirname $0`
# update from remote
git fetch -p
git checkout master
git pull
# replace version numbers
SED="sed -i"
test `uname` == Darwin && SED="sed -i .delete-me"
$SED "s|VERSION=.*|VERSION='$1'|" bin/parallel-phpunit > tmp
$SED "s|Running parallel-phpunit [^\\]*|Running parallel-phpunit $1|" tests/ParallelPhpUnitTest.php > tmp
$SED "s|checkout .*|checkout $1|" README.md
find . -name "*.delete-me" -delete
perl -pe "s/^Master/\"Master\n\nRelease $1\"/e" README.md > tmp
mv tmp README.md
git commit -m "Release $1" bin/parallel-phpunit tests/ParallelPhpUnitTest.php README.md
# run tests
phpunit tests || fail "Tests fail in branch $1"
# push changes to remote
git tag $1 || fail "Release $1 already done"
git push origin $1
git push origin master
echo "Release $1 done"