-
Notifications
You must be signed in to change notification settings - Fork 182
/
release.sh
executable file
·46 lines (35 loc) · 1.25 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -e
die () {
echo >&2 "$@"
exit 1
}
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.'
OLD_VERSION="$(cargo pkgid -p shared | cut -d '#' -f 2)"
cargo release "$1" --no-confirm --exclude "hostsfile" --exclude "publicip" --execute
# re-stage the manpage commit and the cargo-release commit
git reset --soft @~1
cargo build
for binary in "innernet" "innernet-server"; do
for shell in {fish,zsh,bash,powershell,elvish}; do
"target/debug/$binary" completions $shell > doc/$binary.completions.$shell || die "CLI completion failed for $shell"
done
help2man --no-discard-stderr -s8 "target/debug/$binary" -N > "doc/$binary.8"
gzip -fk "doc/$binary.8"
done
VERSION="$(cargo pkgid -p shared | cut -d '#' -f 2)"
perl -pi -e "s/v$OLD_VERSION/v$VERSION/g" README.md
perl -pi -e "s/$OLD_VERSION/$VERSION/g" wireguard-control/Cargo.toml
git add doc
git add README.md
git add wireguard-control/Cargo.toml
git commit -m "meta: release v$VERSION"
git tag -f -a "v$VERSION" -m "release v$VERSION"