From d7884e9149e534b2bb8db89c5075653153873423 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Thu, 2 Jan 2025 19:53:31 +0000 Subject: [PATCH] fix(ci): build and push correctly --- .gitea/workflows/release.yml | 48 +++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 846ca0d..87cefe0 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -142,33 +142,35 @@ jobs: - name: Print metadata run: | - echo "Annotations: ${{ steps.meta.outputs.annotations }}" + printf "Annotations:\n${{ steps.meta.outputs.annotations }}" echo "" - echo "Labels: ${{ steps.meta.outputs.labels }}" + printf "Labels:\n${{ steps.meta.outputs.labels }}" echo "" - echo "Tags: ${{ steps.meta.outputs.tags }}" + printf "Tags:\n${{ steps.meta.outputs.tags }}" - - name: Build images - uses: docker/build-push-action@v5 - with: - context: . - push: false - annotations: ${{ steps.meta.outputs.annotations }} - labels: ${{ steps.meta.outputs.labels }} - tags: ${{ steps.meta.outputs.tags }} - # - name: Build images - # run: | - # dkrannotations="" - # dkrlabels="" - # dkrtags="" - # for i in "${{ steps.meta.outputs.annotations }}"; do dkrannotations="$dkrannotations --annotation $i"; done - # for i in "${{ steps.meta.outputs.labels }}"; do dkrlabels="$dkrlabels --label $i"; done - # for i in "${{ steps.meta.outputs.tags }}"; do dkrtags="$dkrtags --tag $i"; done - # bldcmd="docker buildx build $dkrannotations $dkrlabels $dkrtags ." - # echo $bldcmd - # sh -c "$bldcmd ${{ gitea.workspace }}" - # unset dkrannotations dkrlabels dkrtags bldcmd + # uses: docker/build-push-action@v5 + # with: + # context: . + # push: false + # annotations: ${{ steps.meta.outputs.annotations }} + # labels: ${{ steps.meta.outputs.labels }} + # tags: ${{ steps.meta.outputs.tags }} + + - name: Build images + run: | + bldcmd="docker buildx build ." + strtags="${{ steps.meta.outputs.tags }}" + strlabels="${{ steps.meta.outputs.labels }}" + strannotations="${{ steps.meta.outputs.annotations }}" + readarray -t tags <<<"$strtags" + readarray -t labels <<<"$labels" + readarray -t annotations <<<"$annotations" + for element in "${tags[@]}"; do bldcmd="$bldcmd --tag \"$element\""; done + for element in "${labels[@]}"; do bldcmd="$bldcmd --label \"$element\""; done + for element in "${annotations[@]}"; do bldcmd="$bldcmd --annotation \"$element\""; done + echo $bldcmd + sh -c "$bldcmd ${{ gitea.workspace }}" - name: Push images run: |