Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ jobs:
if ('${{ github.ref_type }}' -eq 'tag') {
$version = '${{ github.ref_name }}' -replace '^[vV]', ''
}
elseif ('${{ github.ref }}'.StartsWith('refs/heads/release/v')) {
$version = '${{ github.ref_name }}' -replace '^release/[vV]', ''
}
elseif ('${{ github.event_name }}' -eq 'workflow_dispatch') {
$version = '${{ inputs.version }}'
if ([string]::IsNullOrWhiteSpace($version)) {
$version = '0.0.0-dev'
}
$version = $version -replace '^[vV]', ''
}
elseif (('${{ github.event_name }}' -eq 'push') -and '${{ github.ref }}'.StartsWith('refs/heads/release/v')) {
$version = '${{ github.ref_name }}' -replace '^release/[vV]', ''
}
else {
$version = "0.0.0-pr.$env:GITHUB_RUN_NUMBER"
}
Expand Down Expand Up @@ -265,7 +265,7 @@ jobs:

release:
name: Publish GitHub Release
if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/heads/release/v')
if: github.ref_type == 'tag' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate tag releases on push events too

For a workflow_dispatch run started against a tag ref, github.ref_type is still tag, so this condition still runs the public release job even though the change is meant to make manual dispatches artifact-only. In that same scenario the version step also resolves from the tag before checking workflow_dispatch, so a maintainer trying to produce a manual artifact from a tag can still publish or update the GitHub Release; require github.event_name == 'push' for the tag path as well.

Useful? React with 👍 / 👎.

needs: package
runs-on: ubuntu-latest
permissions:
Expand Down
Loading