2021-04-09 07:09:55 +02:00
|
|
|
#!/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
|
2021-04-09 07:09:55 +02:00
|
|
|
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-09-15 18:33:38 +02:00
|
|
|
OLD_VERSION="$(cargo pkgid -p shared | cut -d '#' -f 2)"
|
2021-05-09 14:17:23 +02:00
|
|
|
|
2021-09-14 10:26:11 +02:00
|
|
|
cargo release "$1" --no-confirm --exclude "hostsfile" --exclude "publicip" --execute
|
2021-04-09 09:25:26 +02:00
|
|
|
|
|
|
|
# re-stage the manpage commit and the cargo-release commit
|
|
|
|
git reset --soft @~1
|
|
|
|
|
2021-04-09 07:09:55 +02:00
|
|
|
cargo build
|
|
|
|
|
|
|
|
for binary in "innernet" "innernet-server"; do
|
2021-05-25 09:10:16 +02:00
|
|
|
for shell in {fish,zsh,bash,powershell,elvish}; do
|
2021-05-31 17:11:14 +02:00
|
|
|
"target/debug/$binary" completions $shell > doc/$binary.completions.$shell || die "CLI completion failed for $shell"
|
2021-05-25 09:10:16 +02:00
|
|
|
done
|
2021-04-09 07:09:55 +02:00
|
|
|
help2man --no-discard-stderr -s8 "target/debug/$binary" -N > "doc/$binary.8"
|
2021-04-09 09:15:46 +02:00
|
|
|
gzip -fk "doc/$binary.8"
|
2021-04-09 07:09:55 +02:00
|
|
|
done
|
|
|
|
|
2021-09-15 18:33:38 +02:00
|
|
|
VERSION="$(cargo pkgid -p shared | cut -d '#' -f 2)"
|
2021-04-09 07:09:55 +02:00
|
|
|
|
2021-09-15 18:33:38 +02:00
|
|
|
perl -pi -e "s/v$OLD_VERSION/v$VERSION/g" README.md
|
|
|
|
perl -pi -e "s/$OLD_VERSION/$VERSION/g" wireguard-control/Cargo.toml
|
2021-05-09 14:35:21 +02:00
|
|
|
|
|
|
|
git add doc
|
|
|
|
git add README.md
|
2021-09-15 18:33:38 +02:00
|
|
|
git add wireguard-control/Cargo.toml
|
|
|
|
git commit -m "meta: release v$VERSION"
|
|
|
|
git tag -f -a "v$VERSION" -m "release v$VERSION"
|