-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (147 loc) · 4.9 KB
/
build.yml
File metadata and controls
182 lines (147 loc) · 4.9 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
check-frontend:
name: Check Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: "22"
- uses: pnpm/action-setup@v4
with:
version: 10
- name: Install
working-directory: ChuChartManager/Front
run: pnpm install
- name: Type Check
working-directory: ChuChartManager/Front
run: pnpm vue-tsc --noEmit
- name: Build
working-directory: ChuChartManager/Front
run: pnpm build
- name: Upload wwwroot
uses: actions/upload-artifact@v4
with:
name: wwwroot
path: ChuChartManager/wwwroot
check-backend:
name: Check Backend
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
dotnet-quality: "preview"
- name: Build
run: dotnet build ChuChartManager/ChuChartManager.csproj -c Release
build:
name: Build (zip)
runs-on: windows-latest
needs: [check-frontend, check-backend]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: "22"
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
dotnet-quality: "preview"
- name: Build Frontend
working-directory: ChuChartManager/Front
run: |
pnpm install
pnpm build
- name: Publish
run: dotnet publish ChuChartManager/ChuChartManager.csproj -c Release -r win-x64 --self-contained -o publish /p:PublishSingleFile=false /p:ErrorOnDuplicatePublishOutputFiles=false
- name: Package
shell: pwsh
run: Compress-Archive -Path publish/* -DestinationPath ChuChartManager-win-x64.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ChuChartManager-win-x64
path: ChuChartManager-win-x64.zip
build-canary-appx:
name: Build Canary Appx
runs-on: self-hosted
needs: [check-frontend]
steps:
- run: git config --global core.longPaths true
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Download wwwroot
uses: actions/download-artifact@v4
with:
name: wwwroot
path: ChuChartManager/wwwroot
- name: Build Appx
shell: pwsh
# self-hosted runner 已配 .NET SDK / Windows SDK / D:\Sign\signcode.cmd
run: .\Packaging\Build.ps1 -Mode Canary
- name: Upload Appx artifact
uses: actions/upload-artifact@v4
with:
name: ChuChartManager-Canary-Appx
path: Packaging/ChuChartManager_Canary_*.appx
- name: Upload to Alist
shell: pwsh
env:
ALIST_TOKEN: ${{ secrets.ALIST_TOKEN }}
run: |
$alistUrl = "https://alist.c5y.moe"
$appxFile = Get-ChildItem -Path "Packaging" -Filter "ChuChartManager_Canary_*.appx" | Select-Object -First 1
if (-not $appxFile) { throw "No appx file found!" }
Write-Host "Uploading $($appxFile.Name)..."
$remotePath = "/SBGA/ChuChartManager Canary/$($appxFile.Name)"
$encodedPath = [System.Uri]::EscapeDataString($remotePath)
$headers = @{
"Authorization" = $env:ALIST_TOKEN
"File-Path" = $encodedPath
}
Invoke-RestMethod -Uri "$alistUrl/api/fs/put" -Method Put -InFile $appxFile.FullName -Headers $headers
Write-Host "Upload complete: $remotePath"
- name: Update AppInstaller Config
shell: powershell
run: |
$appxFile = Get-ChildItem -Path "Packaging" -Filter "ChuChartManager_Canary_*.appx" | Select-Object -First 1
if (-not $appxFile) { throw "Appx file not found for version extraction!" }
# 从 ChuChartManager_Canary_X.Y.Z.W.appx 提取版本号
$version = $appxFile.Name -replace 'ChuChartManager_Canary_', '' -replace '\.appx$', ''
Write-Host "Detected Version: $version"
& "D:\sign\ccm-canary-update.ps1" -Version $version
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: ChuChartManager-win-x64
- uses: softprops/action-gh-release@v2
with:
files: ChuChartManager-win-x64.zip
generate_release_notes: true
prerelease: false