-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2.29 KB
/
dotnet-desktop.yml
File metadata and controls
84 lines (71 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Release TapCaps
on:
push:
tags:
- "v*.*.*"
jobs:
release:
runs-on: windows-latest
env:
SOLUTION_FILE: TapCaps.sln
BUILD_CONFIGURATION: Release
BUILD_PLATFORM: "Any CPU"
steps:
# 1️⃣ Checkout
- name: Checkout
uses: actions/checkout@v4
# 2️⃣ Setup MSBuild
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
# 3️⃣ Restore NuGet
- name: Restore NuGet packages
shell: pwsh
run: nuget restore $env:SOLUTION_FILE
# 4️⃣ Build Release
- name: Build
shell: pwsh
run: |
msbuild $env:SOLUTION_FILE `
/p:Configuration=$env:BUILD_CONFIGURATION `
/p:Platform="$env:BUILD_PLATFORM"
# 5️⃣ 从 Git tag 注入版本号
- name: Set app version
shell: pwsh
run: |
$version = "${{ github.ref_name }}"
echo "APP_VERSION=$version" >> $env:GITHUB_ENV
Write-Host "APP_VERSION=$version"
# 6️⃣ 安装 Inno Setup
- name: Install Inno Setup
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
curl.exe -OL https://files.jrsoftware.org/is/6/innosetup-6.5.0.exe
.\innosetup-6.5.0.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART
"C:\Program Files (x86)\Inno Setup 6" >> $env:GITHUB_PATH
# 7️⃣ 使用 Inno Setup 生成安装包
- name: Build installer
shell: pwsh
run: |
iscc Inno/inno_setup.iss
# 8️⃣ 校验安装包是否生成
- name: Verify installer
shell: pwsh
run: |
$path = "Inno/Output/TapCaps_Setup_${{ github.ref_name }}.exe"
if (!(Test-Path $path)) {
Write-Error "Installer not found: $path"
exit 1
}
Write-Host "Found installer: $path"
# 9️⃣ 发布 Setup.exe 到 GitHub Releases
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: TapCaps ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: |
Inno/Output/TapCaps_Setup_${{ github.ref_name }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}