;dev: extract tools/push

This commit is contained in:
Simon Michael 2022-12-11 11:30:48 -10:00
parent 76165f962d
commit b49968ee32
2 changed files with 35 additions and 10 deletions

31
tools/push Executable file
View File

@ -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"

View File

@ -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\