-
Notifications
You must be signed in to change notification settings - Fork 0
/
release
executable file
·47 lines (38 loc) · 1006 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
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# check whether repository is clean
if [[ -n "$(git status -s)" ]]
then
echo "you need to commit pending changes first"
exit 1
fi
# get parameters
if [[ "$#" -eq 0 ]]
then
echo "you need to specify the version (#.#.#)"
exit 1
fi
VERSION="$1"
DATE="$(date -I)"
# update toolbox description with version and date
echo "updating toolbox description"
sed -i 's/^% Version .*/% Version '$VERSION' '$DATE'/' toolbox/Contents.m
# create release file
echo "zipping toolbox as release asset"
RFN="cvcrossmanova-$VERSION"
ln -s toolbox/ "$RFN"
zip "$RFN.zip" "$RFN"/*
rm "$RFN"
exit 2
# commit changed toolbox description with release version & push
echo "creating commit for release"
git commit -a -m "Release version $VERSION"
git push
# create & push tag
echo "creating tag for release"
TAG="v$VERSION"
git tag "$VERSION"
git push --tags
# create release
echo "creating release with tag $TAG and asset $RFN.zip"
gh release create "$TAG" "$RFN.zip"
echo "you can now delete $RFN.zip"