Skip to content

Commit d28876b

Browse files
committed
Revert "Revert "Revert "temporarily revert Windows signing changes"""
This reverts commit 08c2ff5. Let's give this another try.
1 parent 3f136f7 commit d28876b

File tree

1 file changed

+105
-1
lines changed

1 file changed

+105
-1
lines changed

.github/workflows/release.yml

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,42 +127,53 @@ jobs:
127127
# https://github.com/nextest-rs/nextest/issues/1055
128128
build-target: x86_64-unknown-linux-gnu.2.27
129129
build-tool: cargo-zigbuild
130+
dry-run: false
130131
- target: x86_64-pc-windows-msvc
131132
os: windows-latest
132133
build-target: x86_64-pc-windows-msvc
133134
build-tool: cargo
135+
# The Windows builds go through a signing process, so we set dry-run
136+
# in the upload-rust-binary-action to true
137+
dry-run: true
134138
- target: i686-pc-windows-msvc
135139
os: windows-latest
136140
build-target: i686-pc-windows-msvc
137141
build-tool: cargo
142+
dry-run: true
138143
- target: aarch64-pc-windows-msvc
139144
os: windows-latest
140145
build-target: aarch64-pc-windows-msvc
141146
build-tool: cargo
147+
dry-run: true
142148
- target: universal-apple-darwin
143149
# macos-14 for M1 runners
144150
os: macos-14
145151
build-target: universal-apple-darwin
146152
build-tool: cargo
153+
dry-run: false
147154

148155
# Builds using cross
149156
- target: x86_64-unknown-linux-musl
150157
os: ubuntu-22.04
151158
build-target: x86_64-unknown-linux-musl
152159
# musl is statically linked and uses cross
153160
build-tool: cross
161+
dry-run: false
154162
- target: aarch64-unknown-linux-gnu
155163
os: ubuntu-22.04
156164
build-target: aarch64-unknown-linux-gnu
157165
build-tool: cross
166+
dry-run: false
158167
- target: x86_64-unknown-freebsd
159168
os: ubuntu-22.04
160169
build-target: x86_64-unknown-freebsd
161170
build-tool: cross
171+
dry-run: false
162172
- target: x86_64-unknown-illumos
163173
os: ubuntu-22.04
164174
build-target: x86_64-unknown-illumos
165175
build-tool: cross
176+
dry-run: false
166177
runs-on: ${{ matrix.os }}
167178
steps:
168179
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -172,6 +183,7 @@ jobs:
172183
if: startsWith(matrix.os, 'macos')
173184
run: |
174185
brew install b2sum
186+
175187
- uses: taiki-e/upload-rust-binary-action@3962470d6e7f1993108411bc3f75a135ec67fc8c # v1.27.0
176188
with:
177189
bin: cargo-nextest
@@ -180,12 +192,104 @@ jobs:
180192
build-tool: ${{ matrix.build-tool }}
181193
target: ${{ matrix.build-target }}
182194
tar: all
183-
zip: windows
184195
checksum: b2,sha256
196+
dry-run: ${{ matrix.dry-run }}
197+
dry-run-intended: ${{ matrix.dry-run }}
185198
env:
186199
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
187200
CARGO_PROFILE_RELEASE_LTO: true
188201
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
202+
203+
- name: Install just on Windows
204+
if: endsWith(matrix.target, '-pc-windows-msvc')
205+
uses: taiki-e/install-action@just
206+
- name: Download verpatch on Windows
207+
if: endsWith(matrix.target, '-pc-windows-msvc')
208+
shell: bash
209+
run: |
210+
set -x
211+
mkdir -p target/unsigned
212+
cd target/unsigned
213+
cp ../${{ matrix.build-target }}/release/cargo-nextest.exe .
214+
curl -LsSfO "https://github.com/nextest-rs/mukti/releases/download/verpatch-1.0.10/verpatch-bin-1.0.10.zip"
215+
unzip verpatch-bin-1.0.10.zip
216+
- name: Add metadata to Windows binary
217+
if: endsWith(matrix.target, '-pc-windows-msvc')
218+
# Bash seems to screw up argument parsing for verpatch. We really should
219+
# rewrite this tool in Rust at some point.
220+
shell: powershell
221+
run: |
222+
cd target/unsigned
223+
# Extract version from ref_name, e.g. cargo-nextest-0.9.97 -> 0.9.97
224+
$refName = "${{ github.ref_name }}"
225+
if ($refName -match "^cargo-nextest-(.+)$") {
226+
$version = $Matches[1]
227+
} else {
228+
Write-Error "Could not extract version from ref_name: $refName"
229+
exit 1
230+
}
231+
.\verpatch.exe /va .\cargo-nextest.exe `
232+
$version /high `
233+
/pv $version `
234+
/s product "cargo-nextest" `
235+
/s "(c)" "(c) The nextest Contributors. License: MIT OR Apache-2.0"
236+
- name: Get the Windows signing policy slug
237+
if: endsWith(matrix.target, '-pc-windows-msvc')
238+
id: get-signing-policy-slug
239+
shell: bash
240+
run: |
241+
just win-signing-policy-slug "${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
242+
243+
- name: Upload unsigned Windows artifact
244+
id: upload-unsigned-artifact
245+
if: endsWith(matrix.target, '-pc-windows-msvc')
246+
uses: actions/upload-artifact@v4
247+
with:
248+
name: ${{ matrix.target }}-unsigned
249+
path: target/unsigned/cargo-nextest.exe
250+
- run: mkdir -p target/signed
251+
if: endsWith(matrix.target, '-pc-windows-msvc')
252+
- name: Submit Windows artifact signing request
253+
id: submit-signing-request
254+
if: endsWith(matrix.target, '-pc-windows-msvc')
255+
uses: signpath/[email protected]
256+
with:
257+
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
258+
organization-id: '34634019-2ee0-4162-830a-72cd1a0cb73f'
259+
project-slug: 'nextest'
260+
signing-policy-slug: '${{ steps.get-signing-policy-slug.outputs.signing-policy-slug }}'
261+
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
262+
wait-for-completion: true
263+
output-artifact-directory: 'target/signed'
264+
- name: Archive and upload Windows artifacts
265+
id: archive-windows-artifact
266+
if: endsWith(matrix.target, '-pc-windows-msvc')
267+
shell: bash
268+
env:
269+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
270+
run: |
271+
set -x
272+
cd target/signed
273+
274+
tar -czf ${{ github.ref_name }}-${{ matrix.target }}.tar.gz cargo-nextest.exe
275+
# Windows has 7z, not zip.
276+
7z a ${{ github.ref_name }}-${{ matrix.target }}.zip cargo-nextest.exe
277+
278+
sha256sum --binary \
279+
${{ github.ref_name }}-${{ matrix.target }}.tar.gz \
280+
${{ github.ref_name }}-${{ matrix.target }}.zip \
281+
> ${{ github.ref_name }}-${{ matrix.target }}.sha256
282+
b2sum --binary \
283+
${{ github.ref_name }}-${{ matrix.target }}.tar.gz \
284+
${{ github.ref_name }}-${{ matrix.target }}.zip \
285+
> ${{ github.ref_name }}-${{ matrix.target }}.b2
286+
287+
gh release upload ${{ github.ref_name }} \
288+
${{ github.ref_name }}-${{ matrix.target }}.tar.gz \
289+
${{ github.ref_name }}-${{ matrix.target }}.zip \
290+
${{ github.ref_name }}-${{ matrix.target }}.sha256 \
291+
${{ github.ref_name }}-${{ matrix.target }}.b2
292+
189293
- name: Set archive output variable
190294
id: archive-output
191295
shell: bash

0 commit comments

Comments
 (0)