-
Notifications
You must be signed in to change notification settings - Fork 14
/
release.sh
executable file
·45 lines (29 loc) · 1000 Bytes
/
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
#!/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/settings.py
sed -E -i "s|$LATEST_VERSION|$NEXT_VERSION|g" docker/docker.sh
}
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
git push --tags
echo "Concluído"
}
change_files
commit_and_push