From 8008b849ffd652eddcd88aa1ac7e43d19c9e1185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Georger?= Date: Sat, 20 Apr 2024 07:00:39 -0400 Subject: [PATCH] Refactor multi-build.yaml workflow to update GHCR_IMAGE environment variable, enable Trivy vulnerability scanning, and use GITHUB_ENV for setting environment variables --- .github/workflows/multi-build.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/multi-build.yaml b/.github/workflows/multi-build.yaml index a91b636..0524a86 100644 --- a/.github/workflows/multi-build.yaml +++ b/.github/workflows/multi-build.yaml @@ -56,6 +56,8 @@ jobs: if [ ${{ env.GITHUB_EVENT_NAME }} == workflow_dispatch ]; then echo "GHOST_VERSION=${{ github.event.inputs.ghost_version }}" >> $GITHUB_OUTPUT echo "MANUAL_TAG=${{ github.event.inputs.manual-tag }}" >> $GITHUB_OUTPUT + echo "GHOST_VERSION=${{ github.event.inputs.ghost_version }}" >> $GITHUB_ENV + echo "MANUAL_TAG=${{ github.event.inputs.manual-tag }}" >> $GITHUB_ENV else echo "GHOST_VERSION=$(curl -s https://api.github.com/repos/tryghost/ghost/releases/latest | jq '.name' | sed 's/\"//g')" >> $GITHUB_OUTPUT fi @@ -72,11 +74,11 @@ jobs: continue-on-error: true with: images: ${{ env.GHCR_IMAGE }} - tags: | - type=raw,value=latest,enable=${{ github.event_name == 'push' || github.ref == 'refs/heads/main' || github.event.ref == 'tags/v*' }} - type=raw,value=main,enable=${{ github.event_name == 'push' || github.ref == 'refs/heads/main' || github.event.ref == 'tags/v*' }} - type=raw,value=${{ steps.versions.outputs.MANUAL_TAG }},enable=${{ github.event_name == 'workflow_dispatch' }} - type=raw,value=v${{ steps.versions.outputs.GHOST_VERSION }},enable=${{ github.event_name == 'workflow_dispatch' }} + # tags: | + # type=raw,value=latest,enable=${{ github.event_name == 'push' || github.ref == 'refs/heads/main' || github.event.ref == 'tags/v*' }} + # type=raw,value=main,enable=${{ github.event_name == 'push' || github.ref == 'refs/heads/main' || github.event.ref == 'tags/v*' }} + # type=raw,value=${{ steps.versions.outputs.MANUAL_TAG }},enable=${{ github.event_name == 'workflow_dispatch' }} + # type=raw,value=v${{ steps.versions.outputs.GHOST_VERSION }},enable=${{ github.event_name == 'workflow_dispatch' }} - name: Set up QEMU @@ -151,10 +153,10 @@ jobs: with: images: ${{ env.GHCR_IMAGE }} tags: | - type=raw,value=latest,enable=${{is_default_branch}} - type=raw,value=main,enable=${{is_default_branch}} - type=raw,value=${{ steps.git.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }} - type=raw,value=v${{ steps.versions.outputs.GHOST_VERSION }},enable=${{ github.event_name == 'workflow_dispatch' }} + type=raw,value=latest,enable=${{ github.event_name == 'push' || github.ref == 'refs/heads/main' || github.event.ref == 'tags/v*' }} + type=raw,value=main,enable=${{ github.event_name == 'push' || github.ref == 'refs/heads/main' || github.event.ref == 'tags/v*' }} + type=raw,value=${{ github.env.MANUAL_TAG }},enable=${{ github.event_name == 'workflow_dispatch' }} + type=raw,value=v${{ github.env.GHOST_VERSION }},enable=${{ github.event_name == 'workflow_dispatch' }} - name: Login to GitHub Container Registry uses: docker/login-action@v3