Skip to content

Commit

Permalink
Handle invalid refs for Docker tag
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicWink committed Mar 19, 2024
1 parent 4e038bc commit cc5d3e3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
release:
types: [created]

env:
REF_SLUG: ${{ contains(github.ref_name, '/') && github.sha || github.ref_name }}

jobs:
build-and-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -39,21 +42,21 @@ jobs:
with:
context: .
load: true
tags: epicwink/proxpi:${{ github.ref_name }}-${{ matrix.platform.image-suffix }}
tags: epicwink/proxpi:${{ env.REF_SLUG }}-${{ matrix.platform.image-suffix }}
platforms: ${{ matrix.platform.name }}

- name: Run unit-tests in image for ${{ matrix.platform.image-suffix }}
run: docker run
--rm
--volume "$(pwd)/tests:/srv/tests"
--entrypoint ''
"epicwink/proxpi:${{ github.ref_name }}-${{ matrix.platform.image-suffix }}"
"epicwink/proxpi:${{ env.REF_SLUG }}-${{ matrix.platform.image-suffix }}"
sh -c 'uname -a && pip install --requirement /srv/tests/requirements.txt
&& pytest -vvra /srv/tests'

- name: Run image test for ${{ matrix.platform.image-suffix }}
run: tests/test-docker-image.sh
"epicwink/proxpi:${{ github.ref_name }}-${{ matrix.platform.image-suffix }}"
"epicwink/proxpi:${{ env.REF_SLUG }}-${{ matrix.platform.image-suffix }}"

build-and-release:
if: ${{ github.event_name == 'release' }}
Expand Down

0 comments on commit cc5d3e3

Please sign in to comment.