Skip to content

Commit 139a03c

Browse files
committed
上传构建产物到 alist
1 parent 55c7932 commit 139a03c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,30 @@ jobs:
5656
run: |
5757
.\Packaging\Build.ps1 -Mode Canary
5858
59+
- name: Upload to Alist
60+
shell: powershell
61+
env:
62+
ALIST_TOKEN: ${{ secrets.ALIST_TOKEN }}
63+
run: |
64+
$alistUrl = "https://alist.c5y.moe"
65+
66+
# 找到构建产物
67+
$appxFile = Get-ChildItem -Path "Packaging" -Filter "MaiChartManager_Canary_*.appx" | Select-Object -First 1
68+
if (-not $appxFile) {
69+
throw "No appx file found!"
70+
}
71+
72+
Write-Host "Uploading $($appxFile.Name)..."
73+
74+
# 上传文件
75+
$remotePath = "/SBGA/MaiChartManager Canary/$($appxFile.Name)"
76+
$encodedPath = [System.Uri]::EscapeDataString($remotePath)
77+
78+
$headers = @{
79+
"Authorization" = $env:ALIST_TOKEN
80+
"File-Path" = $encodedPath
81+
}
82+
83+
Invoke-RestMethod -Uri "$alistUrl/api/fs/put" -Method Put -InFile $appxFile.FullName -Headers $headers
84+
85+
Write-Host "Upload complete: $remotePath"

0 commit comments

Comments
 (0)