File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,11 +49,12 @@ jobs:
4949 - name : ' Prepare files for JSR'
5050 shell : pwsh
5151 run : |
52- $dll = Join-Path (Get-Location) "artifacts/libcpp_bindings_windows.dll"
53- if (-not (Test-Path $dll)) { throw "DLL not found: $dll" }
5452 New-Item -ItemType Directory -Force -Path jsr/bin | Out-Null
55- ./jsr/scripts/embed_binary.ps1 $dll jsr/bin windows-x86_64
56- Copy-Item -Force LICENSE jsr/LICENSE
53+
54+ Copy-Item -Force -LiteralPath artifacts/libcpp_bindings_windows.dll -Destination jsr/bin/libcpp_bindings_windows.dll
55+
56+ ./jsr/scripts/binary_to_json.ps1 artifacts/libcpp_bindings_windows.dll jsr/bin/x86_64.json windows-x86_64
57+
5758 ./jsr/scripts/set_version.ps1 jsr/jsr.json "${{ inputs.version }}"
5859
5960 - name : ' Publish package to JSR (normal)'
Original file line number Diff line number Diff line change 1+ param (
2+ [Parameter (Mandatory = $true )][string ]$BinaryFilePath ,
3+ [Parameter (Mandatory = $true )][string ]$JsonFilePath ,
4+ [Parameter (Mandatory = $true )][string ]$Target
5+ )
6+
7+ $ErrorActionPreference = " Stop"
8+
9+ if (-not (Test-Path - LiteralPath $BinaryFilePath ) -or (Get-Item - LiteralPath $BinaryFilePath ).PSIsContainer) {
10+ Write-Error " Error: Binary path is not a file: $BinaryFilePath "
11+ exit 1
12+ }
13+
14+ $filename = [System.IO.Path ]::GetFileName($BinaryFilePath )
15+
16+ New-Item - ItemType Directory - Force - Path ([System.IO.Path ]::GetDirectoryName($JsonFilePath )) | Out-Null
17+
18+ $bytes = [System.IO.File ]::ReadAllBytes($BinaryFilePath )
19+ $b64 = [System.Convert ]::ToBase64String($bytes )
20+
21+ $obj = [ordered ]@ {
22+ target = $Target
23+ filename = $filename
24+ encoding = " base64"
25+ data = $b64
26+ }
27+
28+ $json = ($obj | ConvertTo-Json - Compress)
29+
30+ Set-Content - Path $JsonFilePath - Value $json - NoNewline - Encoding utf8NoBOM
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments