GitHub Actions: fix typo extracting the branch name

Also deal more gracefully with other potential bugs so that
we don't add an spurious '-' at the end if the branch is empty
for some reason (as that makes the image name invalid).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-12-05 10:36:45 -08:00
parent 5e05a18395
commit f9910caa35

View file

@ -21,10 +21,10 @@ jobs:
run: | run: |
v=${{ github.event.action }} v=${{ github.event.action }}
s=".stage1" s=".stage1"
b=${{ github.event.client_payload.target_branc }} # -BRANCH suffix, unless the branch is master b=${{ github.event.client_payload.target_branch }} # -BRANCH suffix, unless the branch is master
b=${b/refs\/heads\//} b=${b/refs\/heads\//}
b=${b,,} # the name needs to be all lower case b=${b,,} # the name needs to be all lower case
if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi if [ "$b" = "master" ] || [ "$b" = "" ] ; then b="" ; else b="-$b" ; fi
echo "::set-env name=VERSION::${v}${s}" echo "::set-env name=VERSION::${v}${s}"
echo "::set-env name=NAME::subsurface/mxe-build-container${b}:${v}" echo "::set-env name=NAME::subsurface/mxe-build-container${b}:${v}"