1
0
mirror of https://github.com/tonarino/innernet.git synced 2024-11-30 09:06:44 +02:00
innernet/release.sh

41 lines
955 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
die () {
echo >&2 "$@"
exit 1
}
2021-05-09 14:17:23 +02:00
for command in help2man cargo-release sed; do
if ! command -v $command &> /dev/null
then
echo "$command binary could not be found"
exit
fi
done
[ "$#" -eq 1 ] || die "usage: ./release.sh [patch|major|minor|rc]"
git diff --quiet || die 'ERROR: git repo is dirty.'
2021-05-09 14:17:23 +02:00
OLD_VERSION="v$(cargo pkgid -p shared | cut -d '#' -f 2)"
2021-05-09 13:05:29 +02:00
cargo release "$1" --no-confirm --exclude "hostsfile" --exclude "publicip"
# re-stage the manpage commit and the cargo-release commit
git reset --soft @~1
cargo build
for binary in "innernet" "innernet-server"; do
help2man --no-discard-stderr -s8 "target/debug/$binary" -N > "doc/$binary.8"
gzip -fk "doc/$binary.8"
done
git add doc
2021-05-09 14:17:23 +02:00
perl -pi -e "s/$OLD_VERSION/$VERSION/g" README.md
2021-05-09 14:17:23 +02:00
VERSION="v$(cargo pkgid -p shared | cut -d '#' -f 2)"
2021-05-09 14:17:23 +02:00
git commit -m "meta: release $VERSION"
git tag -a "$VERSION" -m "release $VERSION"