-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.sh
executable file
·50 lines (48 loc) · 1.31 KB
/
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
50
#!/bin/bash
#
# Create new release tag
#
# Check any error
if [ $? -eq 0 ]; then
echo ""
echo "Running Colombia Covid19 Pipeline Release ..."
# Check the last version tag
LAST_VERSION=$(hub release | head -n 1)
echo "Lastest release $LAST_VERSION"
# Get the last patch
N=$(echo $LAST_VERSION | tr "." "\n" | tail -n -1)
N=$(($N + 1))
# Create version tag
VERSION="$(($(date +%m))).$(date +%d).$N"
# Create new release
echo "Creating new release $VERSION ..."
git config --global user.email 'sebaxtianrioss@gmail.com'
git config --global user.name 'Sebastian Rios Sabogal'
git tag -a $VERSION -m "$VERSION" master
git push --tags
# Check any error
if [ $? -eq 0 ]; then
# Create covid19co.zip file for assets release
zip -r ./output/covid19co.zip output/
# Create GitHub release
hub release create -a ./output/covid19co.zip -m "v$VERSION" $VERSION
# Finish without error
echo "Finished !"
echo "Release $VERSION was created."
echo ""
# Success
exit 0
else
# Finish with error
echo "Finish with errors ! FAIL"
echo ""
# Fail
exit -1
fi
else
# Finish with error
echo "Finish with errors ! FAIL"
echo ""
# Fail
exit -1
fi