From 199378e9e03b71521273b14b479c1b42e83bd1b8 Mon Sep 17 00:00:00 2001 From: strophy Date: Thu, 29 Jun 2023 21:32:46 +1000 Subject: [PATCH] fix: release context doesn't exist if triggering with workflow_dispatch --- .github/workflows/release.yml | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4eac32f11c..0ee4f3ccdf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,11 +88,11 @@ jobs: with: result-encoding: string script: | - let tag = context.payload.release.tag_name; - if (context.eventName === 'workflow_dispatch') { - tag = '${{ github.event.inputs.tag }}'; - } - return tag; + return ( + context.eventName === 'workflow_dispatch' + ? '${{ github.event.inputs.tag }}' + : context.payload.release.tag_name + ); - name: Build Docker image uses: ./.github/actions/docker @@ -118,11 +118,11 @@ jobs: with: result-encoding: string script: | - let tag = context.payload.release.tag_name; - if (context.eventName === 'workflow_dispatch') { - tag = '${{ github.event.inputs.tag }}'; - } - return tag; + return ( + context.eventName === 'workflow_dispatch' + ? '${{ github.event.inputs.tag }}' + : context.payload.release.tag_name + ); - name: Build Docker image uses: ./.github/actions/docker @@ -148,11 +148,11 @@ jobs: with: result-encoding: string script: | - let tag = context.payload.release.tag_name; - if (context.eventName === 'workflow_dispatch') { - tag = '${{ github.event.inputs.tag }}'; - } - return tag; + return ( + context.eventName === 'workflow_dispatch' + ? '${{ github.event.inputs.tag }}' + : context.payload.release.tag_name + ); - name: Build Docker image uses: ./.github/actions/docker @@ -177,11 +177,11 @@ jobs: with: result-encoding: string script: | - let tag = context.payload.release.tag_name; - if (context.eventName === 'workflow_dispatch') { - tag = '${{ github.event.inputs.tag }}'; - } - return tag; + return ( + context.eventName === 'workflow_dispatch' + ? '${{ github.event.inputs.tag }}' + : context.payload.release.tag_name + ); - name: Build Docker image uses: ./.github/actions/docker @@ -207,11 +207,11 @@ jobs: with: result-encoding: string script: | - let tag = context.payload.release.tag_name; - if (context.eventName === 'workflow_dispatch') { - tag = '${{ github.event.inputs.tag }}'; - } - return tag; + return ( + context.eventName === 'workflow_dispatch' + ? '${{ github.event.inputs.tag }}' + : context.payload.release.tag_name + ); - name: Build Docker image uses: ./.github/actions/docker