From b49968ee327f7531cf7c12dd3f5378eded7822e8 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 11 Dec 2022 11:30:48 -1000 Subject: [PATCH] ;dev: extract tools/push --- tools/push | 31 +++++++++++++++++++++++++++++++ tools/pushdocs | 14 ++++---------- 2 files changed, 35 insertions(+), 10 deletions(-) create mode 100755 tools/push diff --git a/tools/push b/tools/push new file mode 100755 index 000000000..23cc7ddc9 --- /dev/null +++ b/tools/push @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# push [INTERVALSECS] - push to CI branch, watch for a successful run, then push to master + +set -e + +INTERVAL="${1:-10}" + +LOCALBRANCH=master +REMOTECIBRANCH=simon +REMOTEMAINBRANCH=master +NUMRUNS=3 +NUMCOMMITS=5 +CISTARTDELAY=10 # too short, and the script will try to push too early + +ciwait() { + echo "waiting for CI to start..." + sleep $CISTARTDELAY + gh run list -L$NUMRUNS + echo "waiting for CI to finish..." + ciwatch "$INTERVAL" + gh run list -L$NUMRUNS +} + +echo "force-pushing to github/$REMOTECIBRANCH" +git push -f github $LOCALBRANCH:$REMOTECIBRANCH +ciwait +echo "pushing to $REMOTEMAINBRANCH" +git push github $REMOTEMAINBRANCH +echo "Latest commits on github/$REMOTEMAINBRANCH are now:" +git log --format='%ad %h %s%d' --date=short -$NUMCOMMITS github/$REMOTEMAINBRANCH +echo "done" diff --git a/tools/pushdocs b/tools/pushdocs index c3a065bb2..fc6b75c4d 100755 --- a/tools/pushdocs +++ b/tools/pushdocs @@ -1,20 +1,14 @@ #!/usr/bin/env bash -# PROG MSG - commit manuals with ";doc: MSG" prefix, push to CI, then to master +# pushdocs [MSG] - commit manuals with ";doc: MSG" prefix, push to CI, then to master set -e -DELAY=30 -INTERVAL=10 MSG=";doc: $1" -#WAIT="sleep $DELAY" -WAIT="ciwatch $INTERVAL" +DOCS=(hledger/hledger.m4.md hledger-ui/hledger-ui.m4.md hledger-web/hledger-web.m4.md) -git commit -uno -m "$MSG" hledger/hledger.m4.md hledger-ui/hledger-ui.m4.md hledger-web/hledger-web.m4.md || true -git push -f github master:simon \ -&& echo "waiting for CI to finish..." \ -&& $WAIT \ -&& git push github master \ +git commit -uno -m "$MSG" "${DOCS[@]}" hledger-web/hledger-web.m4.md || true +push \ && printf "Docs should be up to date momentarily:\n\ \n\ https://hledger.org/dev/hledger.html\n\