2021-04-09 05:09:55 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
die () {
|
|
|
|
echo >&2 "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2021-05-09 12:17:23 +00:00
|
|
|
for command in help2man cargo-release sed; do
|
2021-04-09 05:09:55 +00: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-05-09 12:17:23 +00:00
|
|
|
OLD_VERSION="v$(cargo pkgid -p shared | cut -d '#' -f 2)"
|
|
|
|
|
2021-05-09 11:05:29 +00:00
|
|
|
cargo release "$1" --no-confirm --exclude "hostsfile" --exclude "publicip"
|
2021-04-09 07:25:26 +00:00
|
|
|
|
|
|
|
# re-stage the manpage commit and the cargo-release commit
|
|
|
|
git reset --soft @~1
|
|
|
|
|
2021-04-09 05:09:55 +00:00
|
|
|
cargo build
|
|
|
|
|
|
|
|
for binary in "innernet" "innernet-server"; do
|
2021-05-25 07:10:16 +00:00
|
|
|
for shell in {fish,zsh,bash,powershell,elvish}; do
|
|
|
|
"target/debug/$binary" completions $shell > doc/$binary.completions.$shell
|
|
|
|
git diff --quiet -- doc/$binary.completions.$shell || die "CLI and Completions out of sync for $shell"
|
|
|
|
done
|
2021-04-09 05:09:55 +00:00
|
|
|
help2man --no-discard-stderr -s8 "target/debug/$binary" -N > "doc/$binary.8"
|
2021-04-09 07:15:46 +00:00
|
|
|
gzip -fk "doc/$binary.8"
|
2021-04-09 05:09:55 +00:00
|
|
|
done
|
|
|
|
|
2021-05-09 12:17:23 +00:00
|
|
|
VERSION="v$(cargo pkgid -p shared | cut -d '#' -f 2)"
|
2021-04-09 05:09:55 +00:00
|
|
|
|
2021-05-09 12:35:21 +00:00
|
|
|
perl -pi -e "s/$OLD_VERSION/$VERSION/g" README.md
|
|
|
|
|
|
|
|
git add doc
|
|
|
|
git add README.md
|
2021-05-09 12:17:23 +00:00
|
|
|
git commit -m "meta: release $VERSION"
|
2021-05-09 12:35:21 +00:00
|
|
|
git tag -f -a "$VERSION" -m "release $VERSION"
|