-
Notifications
You must be signed in to change notification settings - Fork 14
132 lines (108 loc) · 3.63 KB
/
build.yml
File metadata and controls
132 lines (108 loc) · 3.63 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
name: Build Canary
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
build-frontend:
name: Build Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: MaiChartManager/Front/package.json
- name: Install and Build
working-directory: MaiChartManager/Front
run: |
pnpm install
pnpm build
- name: Upload wwwroot
uses: actions/upload-artifact@v4
with:
name: wwwroot
path: MaiChartManager/wwwroot
build:
name: Build
runs-on: self-hosted
needs: build-frontend
steps:
- run: git config --global core.longPaths true
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Checkout Assets
uses: clansty/checkout@main
with:
repository: MuNET-OSS/AquaMai-Build-Assets
token: ${{ secrets.BUILD_ASSETS_PAT }}
path: build-assets
max-attempts: 50
min-retry-interval: 1
max-retry-interval: 5
- name: Copy Assets
shell: powershell
run: |
Write-Host "Copying assets..."
Copy-Item -Path "build-assets/SDEZ/*" -Destination "AquaMai/Libs/" -Recurse -Force
- name: Setup Nuget
run: |
dotnet nuget list source
if (-not (dotnet nuget list source | Select-String "nuget.org")) {
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
}
- name: Download wwwroot
uses: actions/download-artifact@v4
with:
name: wwwroot
path: MaiChartManager/wwwroot
- name: Build
shell: powershell
run: |
.\Packaging\Build.ps1 -Mode Canary
- name: Upload to Alist
shell: powershell
env:
ALIST_TOKEN: ${{ secrets.ALIST_TOKEN }}
run: |
$alistUrl = "https://alist.c5y.moe"
# 找到构建产物
$appxFile = Get-ChildItem -Path "Packaging" -Filter "MaiChartManager_Canary_*.appx" | Select-Object -First 1
if (-not $appxFile) {
throw "No appx file found!"
}
Write-Host "Uploading $($appxFile.Name)..."
# 上传文件
$remotePath = "/SBGA/MaiChartManager 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: |
# 1. 获取构建好的 Appx 文件名来提取版本号
$appxFile = Get-ChildItem -Path "Packaging" -Filter "MaiChartManager_Canary_*.appx" | Select-Object -First 1
if (-not $appxFile) { throw "Appx file not found for version extraction!" }
# 2. 提取版本号 (假设文件名格式为 MaiChartManager_Canary_1.2.3.4.appx)
$version = $appxFile.Name -replace 'MaiChartManager_Canary_', '' -replace '.appx', ''
Write-Host "Detected Version: $version"
# 3. 执行更新脚本
& "D:\sign\mcm-canary-update.ps1" -Version $version
- name: Delete wwwroot artifact
uses: geekyeggo/delete-artifact@v5
with:
name: wwwroot