From 664b33cb78504c3e0b91c50693bf2a6870b2d7eb Mon Sep 17 00:00:00 2001 From: schuer Date: Sat, 23 Dec 2023 23:48:20 +0100 Subject: [PATCH] ci: publish workflow --- .github/workflows/publish.yml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 058ac45..233fb59 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -47,6 +47,8 @@ jobs: name: Publish runs-on: ubuntu-latest needs: [collect] + outputs: + TAGLIST: ${{ steps.tags.outputs.taglist }} strategy: fail-fast: false @@ -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 @@ -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 @@ -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