Skip to content

Commit d534ef8

Browse files
committed
ci: trigger MSI build on push to main, upload as artifact
Switch from tag-based release to push-to-main artifact build: - Trigger: push to main branch - Output: workflow artifact (30-day retention) - Version auto-generated from build time - Drop contents:write permission (no Release creation)
1 parent 83851d9 commit d534ef8

1 file changed

Lines changed: 11 additions & 25 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: Build and Release MSI
1+
name: Build MSI
22

3-
# 觸發時機:push 帶 v 開頭的 tag(例:v1.2.509.1730)
3+
# 觸發時機:push 到 main 分支
44
on:
55
push:
6-
tags:
7-
- 'v*'
6+
branches:
7+
- main
88

99
permissions:
10-
contents: write # 必要,建立 Release + 上傳 asset
10+
contents: read
1111

1212
jobs:
1313
build:
@@ -26,17 +26,6 @@ jobs:
2626
shell: pwsh
2727
run: dotnet tool install --global wix --version 5.0.2
2828

29-
- name: Determine version from tag
30-
id: ver
31-
shell: pwsh
32-
run: |
33-
$tag = "${{ github.ref_name }}"
34-
$version = $tag -replace '^v', ''
35-
Write-Host "Tag: $tag"
36-
Write-Host "Version: $version"
37-
echo "tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
38-
echo "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
39-
4029
- name: Restore
4130
run: dotnet restore Tender.slnx
4231

@@ -49,8 +38,7 @@ jobs:
4938
5039
- name: Build MSI
5140
shell: pwsh
52-
run: |
53-
.\build\build-msi.ps1 -Version "${{ steps.ver.outputs.version }}"
41+
run: .\build\build-msi.ps1
5442

5543
- name: Verify MSI exists
5644
shell: pwsh
@@ -59,11 +47,9 @@ jobs:
5947
$size = (Get-Item "dist\TenderSearch.msi").Length / 1MB
6048
Write-Host ("MSI size: {0:N1} MB" -f $size)
6149
62-
- name: Create GitHub Release with MSI asset
63-
uses: softprops/action-gh-release@v2
50+
- name: Upload MSI as artifact
51+
uses: actions/upload-artifact@v4
6452
with:
65-
tag_name: ${{ steps.ver.outputs.tag }}
66-
name: ${{ steps.ver.outputs.tag }}
67-
generate_release_notes: true
68-
files: |
69-
dist/TenderSearch.msi
53+
name: TenderSearch-MSI
54+
path: dist/TenderSearch.msi
55+
retention-days: 30

0 commit comments

Comments
 (0)