From 0a0ce0793daa3a0f9b609cbbd9751097b939ee79 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Fri, 9 Apr 2021 14:09:55 +0900 Subject: [PATCH] meta: release.sh cargo-release doesn't do everything we want during the release process, so a separate script ends up being necessary if I don't want to forget steps. --- generate_manpage.sh | 15 --------------- release.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 15 deletions(-) delete mode 100755 generate_manpage.sh create mode 100755 release.sh diff --git a/generate_manpage.sh b/generate_manpage.sh deleted file mode 100755 index fec8f9f..0000000 --- a/generate_manpage.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -set -ex - -if ! command -v help2man &> /dev/null -then - echo "help2man binary could not be found" - exit -fi - -cargo build - -for binary in "innernet" "innernet-server"; do - help2man --no-discard-stderr -s8 "target/debug/$binary" -N > "doc/$binary.8" - gzip -f "doc/$binary.8" -done diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..2642a86 --- /dev/null +++ b/release.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -e + +die () { + echo >&2 "$@" + exit 1 +} + +for command in help2man cargo-release; 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.' + +cargo build + +for binary in "innernet" "innernet-server"; do + help2man --no-discard-stderr -s8 "target/debug/$binary" -N > "doc/$binary.8" + gzip -f "doc/$binary.8" +done + +git add doc +git commit -m "meta: update manpages" +cargo release "$1" --no-confirm --exclude "hostsfile" + +# re-stage the manpage commit and the cargo-release commit +git reset --soft @~2 + +VERSION="$(cargo pkgid -p shared | cut -d '#' -f 2)" + +git commit -m "meta: release v$VERSION" +git tag "v$VERSION"