Skip to content

Commit

Permalink
ci: docker handle multiple tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Dec 4, 2023
1 parent d61deee commit 2e02a10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ jobs:
run: |
docker load --input rebar.tar
# output.tags can be an array (ex. v0.2.0, main, latest)
- name: help
run: |
docker run ${{ steps.meta.outputs.tags }} rebar --help
run: >
for tag in ${{ steps.meta.outputs.tags }}; do
docker run $tag rebar --help
done
- name: build and push
uses: docker/build-push-action@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ jobs:
name: rebar-${{ matrix.arch }}
path: target/${{ matrix.arch }}/release

# parse tag from load output, PR have unusual formats
# parse tag from load output, PR have unusual formats, also sometimes multiple tags
- name: load docker image
if: matrix.arch == 'docker'
run: |
load=$(docker load --input target/${{ matrix.arch }}/release/rebar.tar | tee /dev/stderr)
TAG=$(echo $load | tr ":" "\n" | tail -n1)
TAG=$(echo $load | sed 's/Loaded image: //g' | head -n 1 | cut -d ":" -f 2)
echo DOCKER_TAG="$TAG" >> $GITHUB_ENV
# ------------------------------------------------------------------------
Expand Down

0 comments on commit 2e02a10

Please sign in to comment.