Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit ff05a64

Browse files
committed
ci: GitHub Actions 发布脚本
1 parent 007053d commit ff05a64

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,36 @@ jobs:
8787
path: |
8888
./out/*.zip
8989
./out/*.appx
90+
91+
publish:
92+
runs-on: windows-latest
93+
name: Publish
94+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v3
98+
with:
99+
fetch-depth: 0
100+
submodules: recursive
101+
102+
- name: Get commit hash
103+
uses: prompt/actions-commit-hash@v3
104+
id: commit
105+
with:
106+
prefix: "${{ github.event.inputs.release_tag }}+"
107+
108+
- name: Download artifacts
109+
uses: actions/download-artifact@v4
110+
with:
111+
path: ./out
112+
113+
- name: Generate SHA256
114+
run: pwsh -ep bypass ./tools/release-gen/gen-hash.ps1 ./out
115+
116+
- name: Upload APP to release
117+
uses: ncipollo/release-action@v1
118+
with:
119+
artifacts: "./out/*.zip,./out/*.appx"
120+
draft: true
121+
bodyFile: ./out/checksums.md
122+
token: ${{ secrets.GITHUB_TOKEN }}

tools/release-gen/gen-hash.ps1

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
param($path)
2+
3+
echo $path
4+
rm $path/*.md5sum
5+
$files = Get-ChildItem $path
6+
$hashes = [ordered]@{}
7+
$summary = "
8+
9+
***
10+
11+
> [!important]
12+
> 下载时请注意核对文件 SHA256 是否正确。
13+
14+
| 文件名 | SHA256 |
15+
| --- | --- |
16+
"
17+
18+
foreach ($i in $files) {
19+
$name = $i.Name
20+
$hash = Get-FileHash $i -Algorithm SHA256
21+
$hashString = $hash.Hash
22+
$hashes.Add($name, $hashString)
23+
$summary += "| $name | ``${hashString}`` |`n"
24+
}
25+
26+
echo $hashes
27+
28+
$json = ConvertTo-Json $hashes -Compress
29+
30+
$summary += "`n<!-- CLASSISLAND_PKG_MD5 ${json} -->"
31+
echo $summary > "$path/checksums.md"
32+
Write-Host "SHA256 Summary:" -ForegroundColor Gray
33+
Write-Host $summary -ForegroundColor Gray
34+
Write-Host "----------" -ForegroundColor Gray
35+
36+
#if (-not $GITHUB_ACTION -eq $null) {
37+
# 'MD5_SUMMARY=' + $summary.Replace("`n", "<<") | Out-File -FilePath $env:GITHUB_ENV -Append
38+
#}

0 commit comments

Comments
 (0)