Skip to content

Commit b75ed63

Browse files
committed
Create release draft on tag push
1 parent f227fa2 commit b75ed63

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
on:
2-
release:
3-
types: [ published ]
42
pull_request:
3+
push:
4+
branches: [ 'master' ]
5+
tags: [ 'v*.*.*' ]
56

67
jobs:
78
build:
@@ -19,19 +20,19 @@ jobs:
1920

2021
- name: Build
2122
run: |
22-
$ErrorActionPreference = 'Stop'
23-
24-
if ('${{ github.event_name }}' -eq 'release') {
25-
$ver = '${{ github.event.release.tag_name }}'.TrimStart('v')
23+
if ('${{ github.event_name == 'push' && github.ref_type == 'tag' }}' -eq 'true') {
24+
$ver = $env:GITHUB_REF -replace '^refs/tags/v'
2625
} else {
2726
$ver = '0.0.0'
2827
}
2928
3029
dotnet.exe publish AutoAudioSwitcher -o publish -p:Version="$ver"
3130
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' .\Setup\Setup.iss
3231
33-
- name: Upload release artifact
34-
if: github.event_name == 'release'
32+
- name: Create release draft
33+
if: github.event_name == 'push' && github.ref_type == 'tag'
3534
env:
3635
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
run: gh release upload ${{ github.event.release.tag_name }} Setup\Output\AutoAudioSwitcher-Setup.exe
36+
run: |
37+
$tag = $env:GITHUB_REF -replace '^refs/tags/'
38+
gh release create --draft --title $tag $tag Setup\Output\AutoAudioSwitcher-Setup.exe

0 commit comments

Comments
 (0)