From c8dfbc8e2d3fd50958b124bdc4e1ad6b0af8f7ca Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Sat, 14 Sep 2024 10:01:22 +0200 Subject: [PATCH] fix: workflow inputs and docker push (#1123) --- .github/workflows/deployment-docker-image.yml | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deployment-docker-image.yml b/.github/workflows/deployment-docker-image.yml index 3611ae31e..1a8d69642 100644 --- a/.github/workflows/deployment-docker-image.yml +++ b/.github/workflows/deployment-docker-image.yml @@ -38,7 +38,7 @@ jobs: node-version: [20] steps: - name: Discord notification - if: ${{ github.events.inputs.send-notifications }} + if: ${{ github.events.inputs.send-notifications || true }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master @@ -52,7 +52,7 @@ jobs: token: ${{ github.token }} branch: dev - name: Discord notification - if: ${{ github.events.inputs.send-notifications }} + if: ${{ github.events.inputs.send-notifications || true }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master @@ -67,7 +67,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: "pnpm" - name: Discord notification - if: ${{ github.events.inputs.send-notifications }} + if: ${{ github.events.inputs.send-notifications || true }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master @@ -97,19 +97,40 @@ jobs: - name: Build and push id: buildPushAction uses: docker/build-push-action@v6 + if: ${{ github.events.inputs.push-image == 'true' || github.events.inputs.push-image == null }} with: platforms: linux/amd64,linux/arm64 context: . - push: ${{ github.events.inputs.push-image && 'true' || 'false' }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + network: host + env: + SKIP_ENV_VALIDATION: true + - name: Build + id: buildPushDryAction + uses: docker/build-push-action@v6 + if: ${{ github.events.inputs.push-image == 'false' }} + with: + platforms: linux/amd64,linux/arm64 + context: . + push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} network: host env: SKIP_ENV_VALIDATION: true - name: Discord notification - if: ${{ github.events.inputs.send-notifications }} + if: ${{ github.events.inputs.send-notifications || true && (github.events.inputs.push-image == 'true' || github.events.inputs.push-image == null) }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master with: - args: "Deployment of image has completed. Image ID is '${{ steps.buildPushAction.outputs.imageid }}'. This was a dry run." + args: "Deployment of image has completed. Image ID is '${{ steps.buildPushAction.outputs.imageid }}'." + - name: Discord notification + if: ${{ github.events.inputs.send-notifications || true && !(github.events.inputs.push-image == 'true' || github.events.inputs.push-image == null) }} + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: "Deployment of image has completed. Image ID is '${{ steps.buildPushDryAction.outputs.imageid }}'. This was a dry run."