mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:23:23 +00:00
minor cleanups to get-or-create-build-nr script
Deal with shellcheck warnings and make the script less noisy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
504a9b6efe
commit
fe4c602117
1 changed files with 8 additions and 8 deletions
|
@ -18,7 +18,7 @@ cd nightly-builds
|
||||||
latest=$(<latest-subsurface-buildnumber)
|
latest=$(<latest-subsurface-buildnumber)
|
||||||
|
|
||||||
# now let's see if a branch for the current SHA exists
|
# now let's see if a branch for the current SHA exists
|
||||||
if git checkout $SHA_BRANCH
|
if git checkout "$SHA_BRANCH"
|
||||||
then
|
then
|
||||||
# one of the other workflows created a release number already
|
# one of the other workflows created a release number already
|
||||||
latest=$(<latest-subsurface-buildnumber)
|
latest=$(<latest-subsurface-buildnumber)
|
||||||
|
@ -27,13 +27,13 @@ else
|
||||||
# the main branch should have held the previous release number
|
# the main branch should have held the previous release number
|
||||||
# increment by one and write as new build number into the named branch
|
# increment by one and write as new build number into the named branch
|
||||||
latest=$((latest+1))
|
latest=$((latest+1))
|
||||||
git checkout -b $SHA_BRANCH
|
git checkout -b "$SHA_BRANCH"
|
||||||
echo $latest > latest-subsurface-buildnumber
|
echo $latest > latest-subsurface-buildnumber
|
||||||
git commit -a -m "record build number for this SHA"
|
git commit -a -m "record build number for this SHA"
|
||||||
|
|
||||||
# now comes the moment of truth - are we the first one?
|
# now comes the moment of truth - are we the first one?
|
||||||
# the push will succeed for exactly one of the workflows
|
# the push will succeed for exactly one of the workflows
|
||||||
if git push https://github.com/subsurface/nightly-builds $SHA_BRANCH
|
if git push https://github.com/subsurface/nightly-builds "$SHA_BRANCH"
|
||||||
then
|
then
|
||||||
# yay - we win! now let's make sure that we remember this number for next time
|
# yay - we win! now let's make sure that we remember this number for next time
|
||||||
git checkout main
|
git checkout main
|
||||||
|
@ -42,16 +42,16 @@ else
|
||||||
if ! git push https://github.com/subsurface/nightly-builds main
|
if ! git push https://github.com/subsurface/nightly-builds main
|
||||||
then
|
then
|
||||||
echo "push to main failed - we'll lose monotonic property"
|
echo "push to main failed - we'll lose monotonic property"
|
||||||
exit -1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# someone else was faster - get the number they wrote
|
# someone else was faster - get the number they wrote
|
||||||
git checkout main
|
git checkout main &> /dev/null
|
||||||
git branch -D $SHA_BRANCH
|
git branch -D "$SHA_BRANCH" &> /dev/null
|
||||||
if ! git checkout -b $SHA_BRANCH
|
if ! git checkout -b "$SHA_BRANCH" &> /dev/null
|
||||||
then
|
then
|
||||||
echo "push to $SHA_BRANCH failed, but switching to it failed as well"
|
echo "push to $SHA_BRANCH failed, but switching to it failed as well"
|
||||||
exit -2
|
exit 2
|
||||||
fi
|
fi
|
||||||
latest=$(<latest-subsurface-buildnumber)
|
latest=$(<latest-subsurface-buildnumber)
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue