Skip to content

Commit

Permalink
ci: publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
schuer committed Dec 23, 2023
1 parent 66d0bd1 commit 664b33c
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
name: Publish
runs-on: ubuntu-latest
needs: [collect]
outputs:
TAGLIST: ${{ steps.tags.outputs.taglist }}

strategy:
fail-fast: false
Expand All @@ -60,6 +62,21 @@ jobs:
with:
persist-credentials: false

- name: Create tag list for image
id: tags
# Create taglist
# We make use of yp (https://mikefarah.gitbook.io/yq/) to create a JSON array from
# the image’s `tags.yml` file, where all given tags (like `5-stable`, `5-edge`) are
# combined with all image registries (like ghcr, Docker Hub).
run: |
taglist=$(yq 'map(
(
"ghcr.io/friendsofredaxo/redaxo"
)
+ ":" + .[]) | to_json(0)' ./images/${{ matrix.image }}/tags.yml)
echo $taglist
echo "taglist=$taglist" >> $GITHUB_OUTPUT
- name: Set up QEMU
# https://github.com/marketplace/actions/docker-setup-qemu
uses: docker/setup-qemu-action@v3
Expand All @@ -83,13 +100,6 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Collect tags for image
# https://github.com/marketplace/actions/yq-portable-yaml-processor
uses: mikefarah/yq@master
id: collect_tags
with:
cmd: yq '.tags | @csv' ./images/${{ matrix.image }}/tags.yml

- name: Build and push
# https://github.com/marketplace/actions/build-and-push-docker-images
uses: docker/build-push-action@v5
Expand All @@ -98,11 +108,7 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
provenance: false
# tags: |
# ${{ env.REGISTRY_IMAGE }}:${{ steps.collect_tags.outputs.result }}
# ghcr.io/${{ env.REGISTRY_IMAGE }}:${{ steps.collect_tags.outputs.result }}
tags: |
ghcr.io/${{ env.REGISTRY_IMAGE }}:${{ steps.collect_tags.outputs.result }}
tags: ${{ fromJson(needs.publish.outputs.TAGLIST) }}

# - name: Update repo description
# # https://github.com/marketplace/actions/docker-hub-description
Expand Down

0 comments on commit 664b33c

Please sign in to comment.