2017-01-25 12:09:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-06-25 10:37:36 +00:00
|
|
|
# Updates the Version variables, commits, tags and signs
|
2018-05-28 10:40:35 +00:00
|
|
|
|
2020-05-19 08:08:09 +00:00
|
|
|
set -eux
|
2017-01-25 12:09:36 +00:00
|
|
|
|
|
|
|
version="$1"
|
|
|
|
|
|
|
|
if [ -z $version ]; then
|
|
|
|
echo "Need a version!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-04-10 09:59:22 +00:00
|
|
|
make clean
|
2018-12-18 14:44:11 +00:00
|
|
|
sed -i "s/Version = semver\.MustParse.*$/Version = semver.MustParse(\"$version\")/" version/version.go
|
2018-10-01 14:34:22 +00:00
|
|
|
sed -i "s/const Version.*$/const Version = \"$version\"/" cmd/ipfs-cluster-ctl/main.go
|
2020-05-19 08:08:09 +00:00
|
|
|
git add version/version.go cmd/ipfs-cluster-ctl/main.go
|
|
|
|
|
2020-05-19 08:10:08 +00:00
|
|
|
# Next versions, just commit
|
|
|
|
if [[ "$version" == *"-next" ]]; then
|
2020-05-19 08:08:09 +00:00
|
|
|
git commit -S -m "Set development version v${version}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2021-01-14 13:06:53 +00:00
|
|
|
# RC versions, commit and make a tag without history.
|
2020-05-19 08:10:08 +00:00
|
|
|
if [[ "$version" == *"-rc"* ]]; then
|
2020-05-19 08:08:09 +00:00
|
|
|
git commit -S -m "Release candidate v${version}"
|
|
|
|
git tag -s "v${version}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Actual releases, commit and make an annotated tag with all the commits
|
|
|
|
# since the last.
|
|
|
|
git commit -S -m "Release v${version}"
|
2021-01-14 13:06:53 +00:00
|
|
|
lastver=`git describe --abbrev=0 --exclude '*rc*'`
|
2017-11-15 22:39:22 +00:00
|
|
|
echo "Tag for Release ${version}" > tag_annotation
|
|
|
|
echo >> tag_annotation
|
|
|
|
git log --pretty=oneline ${lastver}..HEAD >> tag_annotation
|
2020-05-19 08:08:09 +00:00
|
|
|
git tag -a -s -F tag_annotation "v${version}"
|
|
|
|
rm tag_annotation
|