Skip to content

Commit 0a70eb9

Browse files
authored
CI - Fix package job (#4552)
# Description of Changes We were unable to test #4473 because #githubworkflowthings, and it turns out we broke the job. Here I fixed the job and merge the two jobs into one. **Signing still doesn't work so I've disabled the signing part for now.** # API and ABI breaking changes None. CI only. # Expected complexity level and risk 1 # Testing I ran a test job: https://github.com/clockworklabs/SpacetimeDB/actions/runs/22691343426/job/65787327828 - [x] Package job succeeds for non-windows - [x] Package job succeeds on windows --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
1 parent f160d30 commit 0a70eb9

1 file changed

Lines changed: 41 additions & 79 deletions

File tree

.github/workflows/package.yml

Lines changed: 41 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ permissions:
1111

1212
jobs:
1313
build-cli:
14-
if: ${{ !(startsWith(github.ref, 'refs/tags/') && matrix.target == 'x86_64-pc-windows-msvc') }}
1514
strategy:
1615
fail-fast: false
1716
matrix:
@@ -51,81 +50,45 @@ jobs:
5150
- name: Install rust target
5251
run: rustup target add ${{ matrix.target }}
5352

54-
- name: Compile
55-
run: |
56-
cargo build --release --target ${{ matrix.target }} -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
57-
58-
- name: Package (unix)
59-
if: ${{ runner.os != 'Windows' }}
60-
shell: bash
61-
run: |
62-
mkdir build
63-
cd target/${{matrix.target}}/release
64-
cp spacetimedb-update ../../../build/spacetimedb-update-${{matrix.target}}
65-
tar -czf ../../../build/spacetime-${{matrix.target}}.tar.gz spacetimedb-{cli,standalone}
66-
67-
- name: Package (windows)
53+
- name: Add signtool.exe to PATH
6854
if: ${{ runner.os == 'Windows' }}
69-
shell: bash
55+
shell: pwsh
7056
run: |
71-
mkdir build
72-
cd target/${{matrix.target}}/release
73-
cp spacetimedb-update.exe ../../../build/spacetimedb-update-${{matrix.target}}.exe
74-
7z a ../../../build/spacetime-${{matrix.target}}.zip spacetimedb-cli.exe spacetimedb-standalone.exe
75-
76-
- name: Extract branch name
77-
shell: bash
78-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
79-
id: extract_branch
80-
81-
- name: Upload to DO Spaces
82-
uses: shallwefootball/s3-upload-action@master
83-
with:
84-
aws_key_id: ${{ secrets.AWS_KEY_ID }}
85-
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
86-
aws_bucket: ${{ vars.AWS_BUCKET }}
87-
source_dir: build
88-
endpoint: https://nyc3.digitaloceanspaces.com
89-
destination_dir: ${{ steps.extract_branch.outputs.branch }}
90-
91-
build-cli-windows-signed:
92-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
93-
name: Build and sign CLI for x86_64 Windows
94-
runs-on: [self-hosted, windows, signing]
95-
environment: codesign
96-
concurrency:
97-
group: codesign-${{ github.ref }}
98-
cancel-in-progress: false
99-
100-
steps:
101-
- name: Checkout
102-
uses: actions/checkout@v3
103-
104-
- name: Install Rust
105-
uses: dsherret/rust-toolchain-file@v1
57+
$root = "${env:ProgramFiles(x86)}\Windows Kits\10\bin"
58+
$signtool = Get-ChildItem $root -Recurse -Filter signtool.exe -ErrorAction SilentlyContinue |
59+
Where-Object { $_.FullName -match '\\x64\\signtool\.exe$' } |
60+
Sort-Object FullName -Descending |
61+
Select-Object -First 1
10662
107-
- name: Install rust target
108-
run: rustup target add x86_64-pc-windows-msvc
63+
if (-not $signtool) { throw "signtool.exe not found under $root" }
10964
110-
- name: Compile
111-
run: |
112-
cargo build --release --target x86_64-pc-windows-msvc -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
65+
"Found: $($signtool.FullName)"
66+
$dir = Split-Path $signtool.FullName
67+
Add-Content -Path $env:GITHUB_PATH -Value $dir
11368
114-
- name: Write certificate file
69+
- name: Write certificate file for signing
70+
if: ${{ runner.os == 'Windows' }}
11571
shell: powershell
11672
env:
11773
DIGICERT_CERT_B64: ${{ secrets.DIGICERT_CERT_B64 }}
11874
run: |
119-
[IO.File]::WriteAllBytes("digicert.crt", [Convert]::FromBase64String($env:DIGICERT_CERT_B64))
75+
[IO.File]::WriteAllBytes("digicert.pfx", [Convert]::FromBase64String($env:DIGICERT_CERT_B64))
12076
121-
- name: Sign binaries
77+
- name: Compile
78+
run: |
79+
cargo build --release --target ${{ matrix.target }} -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
80+
81+
- name: Sign binaries for Windows
82+
# Disabled for now since the current flow isn't working.
83+
if: false
84+
#if: ${{ runner.os == 'Windows' }}
12285
shell: powershell
12386
env:
12487
DIGICERT_KEYPAIR_ALIAS: ${{ secrets.DIGICERT_KEYPAIR_ALIAS }}
12588
run: |
12689
$ErrorActionPreference = 'Stop'
12790
$targetDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
128-
$certFile = Join-Path $env:GITHUB_WORKSPACE 'digicert.crt'
91+
$certFile = Join-Path $env:GITHUB_WORKSPACE 'digicert.pfx'
12992
13093
$signtool = Get-Command signtool.exe -ErrorAction Stop
13194
@@ -136,32 +99,31 @@ jobs:
13699
)
137100
138101
foreach ($file in $files) {
139-
& $signtool.Path sign /csp "DigiCert Signing Manager KSP" /kc $env:DIGICERT_KEYPAIR_ALIAS /f $certFile /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $file
102+
& $signtool.Path sign /f $certFile /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $file
140103
& $signtool.Path verify /v /pa $file
141104
}
142105
143-
- name: Package (windows)
144-
shell: powershell
106+
- name: Package (unix)
107+
if: ${{ runner.os != 'Windows' }}
108+
shell: bash
145109
run: |
146-
$ErrorActionPreference = 'Stop'
147-
New-Item -ItemType Directory -Force -Path build | Out-Null
148-
$releaseDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
110+
mkdir build
111+
cd target/${{matrix.target}}/release
112+
cp spacetimedb-update ../../../build/spacetimedb-update-${{matrix.target}}
113+
tar -czf ../../../build/spacetime-${{matrix.target}}.tar.gz spacetimedb-{cli,standalone}
149114
150-
Copy-Item (Join-Path $releaseDir 'spacetimedb-update.exe') (Join-Path $env:GITHUB_WORKSPACE 'build\spacetimedb-update-x86_64-pc-windows-msvc.exe')
151-
Compress-Archive -Force -Path @(
152-
(Join-Path $releaseDir 'spacetimedb-cli.exe'),
153-
(Join-Path $releaseDir 'spacetimedb-standalone.exe')
154-
) -DestinationPath (Join-Path $env:GITHUB_WORKSPACE 'build\spacetime-x86_64-pc-windows-msvc.zip')
115+
- name: Package (windows)
116+
if: ${{ runner.os == 'Windows' }}
117+
shell: bash
118+
run: |
119+
mkdir build
120+
cd target/${{matrix.target}}/release
121+
cp spacetimedb-update.exe ../../../build/spacetimedb-update-${{matrix.target}}.exe
122+
7z a ../../../build/spacetime-${{matrix.target}}.zip spacetimedb-cli.exe spacetimedb-standalone.exe
155123
156124
- name: Extract branch name
157-
shell: powershell
158-
run: |
159-
$ErrorActionPreference = 'Stop'
160-
$branch = $env:GITHUB_HEAD_REF
161-
if ([string]::IsNullOrEmpty($branch)) {
162-
$branch = $env:GITHUB_REF -replace '^refs/heads/', ''
163-
}
164-
"branch=$branch" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
125+
shell: bash
126+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
165127
id: extract_branch
166128

167129
- name: Upload to DO Spaces

0 commit comments

Comments
 (0)