build-docker.yml: Only allow tags as previous version

Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com>
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias K 2023-01-10 10:39:47 +01:00 committed by Tobias Knöppler
parent 127c9bdfb1
commit 74200976ad
No known key found for this signature in database
GPG Key ID: 3510056072886A8F

View File

@ -88,16 +88,14 @@ jobs:
shell: bash
run: |
set -ex
if [[ -n "${{ github.base_ref }}" ]]
then
version="${{ github.base_ref }}"
elif [[ "${{ env.VERSION }}" == "refs/heads/devel" ]]
if [[ "${{ env.VERSION }}" == "refs/heads/devel" ]]
then
version="latest"
else
git checkout "${{ github.base_ref }}"
if [[ "${{ github.ref_type }}" != "tag" ]] || ! git describe --tags > /dev/null
then
git fetch -fu --tags origin ${{ env.VERSION }}:${{ env.VERSION }}
git fetch -fu --tags origin ${{ github.base_ref }}:${{ github.base_ref }}
fi
version="$(git describe --tags || true)"
[[ "$version" =~ .*-.*-.* ]] || {