forked from interlegis/saap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·46 lines (30 loc) · 1.01 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
#!/usr/bin/env bash
##
## Versioning info: [major].[minor].[patch], example: 3.0.112, 3.1.23
##
VERSION_PATTERN='([0-9]+)\.([0-9]+)\.([0-9]+)?'
LATEST_VERSION=$(git tag --sort=committerdate | egrep $VERSION_PATTERN | tail -1)
LAST_DIGIT=`echo $LATEST_VERSION | cut -f 3 -d '.'`
MAIN_REV=`echo $LATEST_VERSION | cut -f 1,2 -d '.'`
NEXT_NUMBER=$(($LAST_DIGIT + 1))
NEXT_VERSION=$MAIN_REV'.'$NEXT_NUMBER
FINAL_VERSION=
function change_files {
echo "Atualizando de "$LATEST_VERSION" para "$NEXT_VERSION"..."
sed -E -i "s|$LATEST_VERSION|$NEXT_VERSION|g" saap/templates/base.html
sed -E -i "s|$LATEST_VERSION|$NEXT_VERSION|g" saap/settings.py
}
function commit_and_push {
echo "Criando o commit..."
git add .
git commit -m "Release: $NEXT_VERSION"
git tag $NEXT_VERSION
echo "Versão criada e gerada localmente."
echo "Enviando para o GitHub a versão $NEXT_VERSION..."
git push origin master
echo "Concluído"
}
git fetch
echo "Release atual: "$LATEST_VERSION
change_files
commit_and_push