Skip to content

Commit 92280dd

Browse files
committed
fix: release workflow - add step id, fix .icpx packaging, copy SDK DLLs
1 parent 3d32dc5 commit 92280dd

1 file changed

Lines changed: 39 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,30 @@ jobs:
3636
with:
3737
dotnet-version: '6.0.x'
3838

39+
- name: Copy SDK DLLs
40+
shell: pwsh
41+
run: |
42+
$framework = "net6.0-windows10.0.19041.0"
43+
$sdkDir = "community/InkCanvas.PluginSdk/bin/Debug/$framework"
44+
$ctrlDir = "community/InkCanvas.Controls/bin/Debug/$framework"
45+
$libDir = "SamplePlugin/lib"
46+
if (Test-Path "$sdkDir/InkCanvas.PluginSdk.dll") {
47+
Copy-Item "$sdkDir/InkCanvas.PluginSdk.dll" $libDir -Force
48+
Write-Host "Copied InkCanvas.PluginSdk.dll"
49+
}
50+
if (Test-Path "$ctrlDir/InkCanvas.Controls.dll") {
51+
Copy-Item "$ctrlDir/InkCanvas.Controls.dll" $libDir -Force
52+
Write-Host "Copied InkCanvas.Controls.dll"
53+
}
54+
3955
- name: Restore dependencies
4056
run: dotnet restore SamplePlugin/SamplePlugin.csproj
4157

4258
- name: Build
4359
run: dotnet build SamplePlugin/SamplePlugin.csproj --configuration Release --no-restore
4460

4561
- name: Package .icpx
62+
id: package
4663
shell: pwsh
4764
run: |
4865
$outputDir = "SamplePlugin/bin/Release/net6.0-windows10.0.19041.0"
@@ -54,25 +71,30 @@ jobs:
5471
if (Test-Path $tempDir) { Remove-Item $tempDir -Recurse -Force }
5572
New-Item -ItemType Directory -Path $tempDir | Out-Null
5673
57-
# 打包必要文件(排除 .pdb 等调试文件)
58-
$files = @("manifest.json", "$($manifest.EntranceAssembly)", "*.deps.json")
59-
foreach ($pattern in $files) {
60-
Get-ChildItem "$outputDir/$pattern" -ErrorAction SilentlyContinue |
61-
Copy-Item -Destination $tempDir
74+
# 打包必要文件
75+
foreach ($f in @("manifest.json", $manifest.EntranceAssembly, "$($manifest.EntranceAssembly -replace '\.dll$','.deps.json')")) {
76+
$src = Join-Path $outputDir $f
77+
if (Test-Path $src) {
78+
Copy-Item $src $tempDir
79+
Write-Host " + $f"
80+
}
6281
}
6382
64-
# 创建 .icpx (ZIP)
65-
$icpxPath = "packages/$pluginId.icpx"
66-
New-Item -ItemType Directory -Path "packages" | Out-Null
67-
Compress-Archive -Path "$tempDir/*" -DestinationPath "$pluginId.zip" -Force
68-
Move-Item "$pluginId.zip" $icpxPath -Force
83+
# 创建 .icpx (先 .zip 再重命名)
84+
$outDir = "SamplePlugin/packages"
85+
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
86+
$zipPath = Join-Path $outDir "$pluginId.zip"
87+
$icpxPath = Join-Path $outDir "$pluginId.icpx"
88+
Compress-Archive -Path "$tempDir/*" -DestinationPath $zipPath -Force
89+
if (Test-Path $icpxPath) { Remove-Item $icpxPath }
90+
Rename-Item $zipPath $icpxPath
6991
7092
# 计算 SHA256
7193
$hash = (Get-FileHash $icpxPath -Algorithm SHA256).Hash.ToLower()
72-
echo "ICPX_PATH=$icpxPath" >> $env:GITHUB_OUTPUT
73-
echo "PLUGIN_ID=$pluginId" >> $env:GITHUB_OUTPUT
74-
echo "SHA256=$hash" >> $env:GITHUB_OUTPUT
75-
echo "VERSION=$($manifest.Version)" >> $env:GITHUB_OUTPUT
94+
echo "icpx_path=$icpxPath" >> $env:GITHUB_OUTPUT
95+
echo "plugin_id=$pluginId" >> $env:GITHUB_OUTPUT
96+
echo "sha256=$hash" >> $env:GITHUB_OUTPUT
97+
echo "version=$($manifest.Version)" >> $env:GITHUB_OUTPUT
7698
Write-Host "Packaged: $icpxPath (SHA256: $hash)"
7799
78100
- name: Get tag
@@ -91,7 +113,7 @@ jobs:
91113
tag_name: ${{ steps.tag.outputs.tag }}
92114
name: ${{ steps.tag.outputs.tag }}
93115
body: |
94-
## ${{ steps.package.outputs.PLUGIN_ID }} ${{ steps.package.outputs.VERSION }}
116+
## ${{ steps.package.outputs.plugin_id }} v${{ steps.package.outputs.version }}
95117
96118
### 安装方法
97119
1. 下载下方的 `.icpx` 文件
@@ -100,9 +122,9 @@ jobs:
100122
101123
### 校验信息
102124
```
103-
SHA256: ${{ steps.package.outputs.SHA256 }}
125+
SHA256: ${{ steps.package.outputs.sha256 }}
104126
```
105-
files: ${{ steps.package.outputs.ICPX_PATH }}
127+
files: ${{ steps.package.outputs.icpx_path }}
106128
draft: false
107129
prerelease: false
108130
env:

0 commit comments

Comments
 (0)