forked from BeyondCodeBootcamp/DuckDNS.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bump.sh
executable file
·50 lines (42 loc) · 1.06 KB
/
bump.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/sh
set -e
set -u
my_version="${1-}"
if [ -z "${my_version}" ]; then
echo "Usage: bump.sh v1.2.3"
exit 1
fi
if ! git diff --quiet; then
echo "Error: git status is dirty"
fi
if ! command -v sd > /dev/null; then
echo "Install 'sd' first."
echo " curl https://webi.sh/sd | sh"
exit 1
fi
my_commit_hash="$(
git rev-parse --short HEAD
)"
my_commit_date="$(
git show -s --format=%ci "${my_commit_hash}" |
grep -E '20[0-9]{2}-[01][0-9]-[0123][0-9]'
)"
my_year="$(
date '+%Y'
)"
sd 'my_version=.*' "my_version='${my_version}'" duckdns.sh
sd 'my_year=.*' "my_year='${my_year}'" duckdns.sh
sd 'my_date=.*' "my_date='${my_commit_date}'" duckdns.sh
git add ./duckdns.sh
git commit -m "chore(release): bump to ${my_version}"
git tag "${my_version}"
git describe --tags
echo "######################"
echo "## ##"
echo "## DON'T FORGET!! ##"
echo "## (publish it) ##"
echo "## ##"
echo "######################"
echo ""
echo "https://github.com/BeyondCodeBootcamp/DuckDNS.sh/releases/new"
echo ""