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
15 changes: 14 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- 'v*.*.*'
branches:
- 'release/v*.*.*'
pull_request:
branches: [ main ]
paths:
Expand Down Expand Up @@ -42,6 +44,7 @@ jobs:
runs-on: windows-latest
outputs:
version: ${{ steps.version.outputs.value }}
tag_name: ${{ steps.version.outputs.tag_name }}
artifact_name: ${{ steps.version.outputs.artifact_name }}

steps:
Expand All @@ -64,6 +67,9 @@ 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)) {
Expand All @@ -79,10 +85,13 @@ jobs:
throw "Unsupported release version: $version"
}

$tagName = "v$version"
$artifactName = "ARSVIN-$version-windows-x64"
"value=$version" >> $env:GITHUB_OUTPUT
"tag_name=$tagName" >> $env:GITHUB_OUTPUT
"artifact_name=$artifactName" >> $env:GITHUB_OUTPUT
Write-Host "Release version: $version"
Write-Host "Release tag: $tagName"

- name: Build and test
shell: pwsh
Expand Down Expand Up @@ -256,7 +265,7 @@ jobs:

release:
name: Publish GitHub Release
if: github.ref_type == 'tag'
if: github.ref_type == 'tag' || 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 Keep manual dispatches artifact-only

When a workflow_dispatch run is started from a release/vX.Y.Z branch, github.ref is still refs/heads/release/vX.Y.Z, so this condition is true even though the event is manual. That turns a manual artifact build from such a branch into a public GitHub Release, and the version step above also resolves the branch name before honoring inputs.version; require the release-branch path to be a push event so manual runs remain artifact-only.

Useful? React with 👍 / 👎.

needs: package
runs-on: ubuntu-latest
permissions:
Expand All @@ -272,6 +281,10 @@ jobs:
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.package.outputs.tag_name }}
target_commitish: ${{ github.sha }}
name: ARSVIN ${{ needs.package.outputs.tag_name }}
make_latest: true
generate_release_notes: true
fail_on_unmatched_files: true
files: |
Expand Down
Loading