Skip to content

Commit

Permalink
fix: invalid tag, invalid suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Aug 22, 2024
1 parent aaf8499 commit 8343840
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/release-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
tag:
type: string
description: Image tag, i.e. v0.1.0; note it can be inherited from 'workflow_dispatch' event
default: ${{ github.event.inputs.tag }}
default: ${{ github.event.inputs.tag || github.event.release.tag_name }}
cargo_profile:
type: string
description: Cargo profile. i.e. release, dev
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
with:
image_name: ${{ inputs.image_name }}
image_org: ${{ inputs.image_org }}
image_version: ${{ github.event.inputs.tag || github.event.release.tag_name }}
image_version: ${{ inputs.tag || github.event.release.tag_name }}
target: ${{ inputs.target }}
platform: ${{ matrix.platform }}
cargo_profile: ${{ inputs.cargo_profile }}
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
with:
result-encoding: string
script: |
return ( "${{ github.event.inputs.tag }}" || context.payload.release.tag_name );
return ( "${{ inputs.tag }}" || context.payload.release.tag_name );
- name: Set suffix
uses: actions/github-script@v6
Expand All @@ -115,10 +115,9 @@ jobs:
result-encoding: string
script: |
const fullTag = '${{ steps.version.outputs.result }}';
if (fullTag.includes('-')) {
const [, fullSuffix] = fullTag.split('-');
const [suffix] = fullSuffix.split('.');
return `-${suffix}`;
const firstMinusIndex = fullTag.indexOf('-');
if (firstMinusIndex !== -1) {
return fullTag.substring(firstMinusIndex);
} else {
return '';
}
Expand Down

0 comments on commit 8343840

Please sign in to comment.