-
Notifications
You must be signed in to change notification settings - Fork 9
/
release
executable file
·56 lines (48 loc) · 1.11 KB
/
release
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
#!/bin/bash
# Prepare oneshot release.
# Covers things I don't know how to do using goreleaser.
CURRENT_VERSION=`git describe --tag --abbrev=0`
NEW_VERSION=""
# Create README.md
rm -f README.md
make README.md
git add README.md
# Create man page
rm -f oneshot.1
make oneshot.1
git add oneshot.1
function updateVersion {
read -p "new version (currently at ${CURRENT_VERSION}): " NEW_VERSION
## Make sure new version has valid format
if [[ $NEW_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
echo "${NEW_VERSION}" > version.txt
git add version.txt
else
echo "invalid version format. try again."
updateVersion
fi
}
updateVersion
# Remove old builds
rm -rf dist
# Show status and ask to commit
git status
read -p "commit and tag? [y/n]: " COMMIT
if [[ $COMMIT == [nN] ]]
then
exit 0
fi
read -p "reuse message for commit and tag? [y/n]: " REUSE
if [[ $REUSE == [yY] ]]
then
read -p "message: " MESSAGE
git commit -m "${MESSAGE}"
git tag -a "${NEW_VERSION}" -m "${MESSAGE}"
else
git commit
git tag -a "${NEW_VERSION}"
fi
# Release
read -p "release? [y/n]: " RELEASE && [[ $RELEASE == [nN] ]] && exit 0
goreleaser