diff --git a/Makefile b/Makefile index 439725c48..d5ae17688 100644 --- a/Makefile +++ b/Makefile @@ -913,8 +913,8 @@ tag-project: $(call def-help,tag-project, make a git release tag for the project # for p in $(PACKAGES); do cabal upload $$p/dist/$$p-$(VERSION).tar.gz -v2 --check; done hackageupload: \ - $(call def-help,hackageupload, upload all packages to hackage ) - for p in $(PACKAGES); do stack upload $$p; done + $(call def-help,hackageupload, upload all packages to hackage from a release branch) + tools/hackageupload $(PACKAGES) # showreleasestats stats: \ # showreleasedays \ diff --git a/tools/hackageupload b/tools/hackageupload new file mode 100755 index 000000000..fb05ff7aa --- /dev/null +++ b/tools/hackageupload @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e + +BRANCH=$(git rev-parse --abbrev-ref HEAD) +if [[ $BRANCH =~ ^[0-9.]*-(branch|release) ]]; then + PACKAGES=$* + printf "\nReady to publish on hackage.haskell.org:\n\n" + for P in $PACKAGES; do + printf "%s %s\n" "$P" "$(grep ^version: "$P"/"$P".cabal | sed -E 's/version: +//')" + done + echo + read -rp "Ok ? Press enter to confirm, ctrl-c to abort: " + for P in $PACKAGES; do + stack upload "$P" + done +else + printf "%s: in $BRANCH branch, please upload from the latest release branch.\n" "$(basename "$0")" + printf "Perhaps: git switch %s\n" $(git branch | grep -E '[0-9.]+-(branch|release)' | tail -1) +fi