-
Notifications
You must be signed in to change notification settings - Fork 51
/
release.sh
executable file
·29 lines (21 loc) · 714 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
#!/usr/bin/env bash
set -e
version=$1
if [ -z "$version" ]; then
echo "No version passed! Example usage: ./release.sh 1.0.0"
exit 1
fi
echo "Running tests..."
go test
echo "Update version..."
echo -n "v${version}" > VERSION
sed -i '' 's/fmt\.Println("v[0-9]*\.[0-9]*\.[0-9]*")/fmt.Println("v'$version'")/' cmd/captain/cmd.go
sed -i '' 's/v[0-9]*\.[0-9]*\.[0-9]*/v'$version'/' README.md
echo "Build binaries..."
make cross
echo "Update repository..."
git add cmd/captain/cmd.go README.md VERSION
git commit -m "Preparing version ${version}"
git tag --message="v$version" "v$version"
echo "v$version tagged."
echo "Now, run 'git push origin master && git push --tags' and publish the release on GitHub."