forked from pagopa-archive/io-infrastructure-modules-new
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease-notes.sh
executable file
·84 lines (55 loc) · 1.28 KB
/
release-notes.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
latest_tags () {
echo "Latest tags!"
git describe --tags `git rev-list --tags --max-count=3`
echo "Status"
git status -uno
}
release () {
echo "=> creating release $1"
# Tag the current branch
echo "Create first tag"
git tag -a $1 -m "Release: $1"
# Create changlog
npx auto-changelog --commit-limit false --unreleased
# Add the change log file:
git add CHANGELOG.md
# Commit changelog
git commit -m "Release: $1"
# push the changelog file.
git push origin master
# Delete tag
git tag -d $1
# Recreate tag
git tag -a $1 -m "Release: $1"
# push the tag
git push origin $1
# push to branch the CHANGELOG.md
git push origin $2
}
dir=$(pwd)
echo "Working directory $dir"
latest_tags
echo "Type the relese number (eg: v2.0.1)"
read rel
if [ -z "$rel" ]
then
echo "$rel is not a valid release!!"
exit -1
fi
branch=$(git rev-parse --abbrev-ref HEAD)
if [ $branch != "master" ]
then
echo "Warning !!! you are not in master branch."
echo "Current branch $branch"
else
echo "Did you run: >> git pull origin master? "
fi
echo "Proceed to create release $rel?"
echo "Continue Yes(y) or No(n)"
read accept
if [ $accept != "y" ]
then
exit 0
fi
release $rel $branch