-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-release.sh
executable file
·49 lines (37 loc) · 1.1 KB
/
make-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
#!/bin/bash
set -e
set -o pipefail
ver=$1
if [ "$ver" == "" ]; then
echo "Usage: $0 version" >&2
exit 1
fi
# Update NAMESPACE and man/*.Rd files. If this changes anything, the check for uncomitted
# changes below will fire.
Rscript -e 'roxygen2::roxygenize()'
if [ "$(git symbolic-ref --short HEAD)" != "master" ]; then
echo "Currently checkout out branch must be 'master'" >&2
exit 1
fi
if [ $(git status --porcelain | wc -l) != 0 ]; then
echo "Working copy contaisn uncommitted changes" >&2
exit 1
fi
if [ $(git ls-remote --tags origin v$ver | wc -l) != 0 ]; then
echo "Version $ver already released (remote tag v$ver already exists)" >&2
exit 1
fi
# Run tests
Rscript -e 'devtools::test()'
echo "Updating DESCRIPTION" >&2
sed -i.bak 's/^Version: \(.*\)$/Version: '"$ver"'/' DESCRIPTION
rm DESCRIPTION.bak
echo "Comitting change" >&2
git add DESCRIPTION
git commit -m "Incremented version to $ver"
echo "Tagging as v$ver and latest" >&2
git tag -f v$ver
echo "Pushing to origin" >&2
git push origin master v$ver
echo "Updating 'latest' on origin" >&2
git push -f origin v$ver:refs/tags/latest-release