Skip to content

Commit 0a13309

Browse files
Sign the binary for windows
1 parent f8b5128 commit 0a13309

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

.github/workflows/pack-pip.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
type: choice
99
default: None # no publishing to any Package Index by default
1010
options: [None, testpypi, pypi]
11+
signature-activation:
12+
type: boolean
13+
required: true
14+
default: false
15+
description: Sign khisto binary
1116
push:
1217
tags: ['*']
1318
pull_request:
@@ -31,6 +36,8 @@ jobs:
3136
strategy:
3237
matrix:
3338
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025-vs2026, windows-11-vs2026-arm, macos-15-intel, macos-15]
39+
env:
40+
SIGN_WINDOWS_WHEELS: ${{ github.event_name == 'workflow_dispatch' && inputs.signature-activation }}
3441
steps:
3542
- uses: actions/checkout@v6
3643

@@ -59,7 +66,36 @@ jobs:
5966
uv sync --python .test-env --group dev --no-install-project
6067
uv run --python .test-env pytest tests/ --no-cov
6168
62-
- uses: actions/upload-artifact@v6
69+
- name: Install wheel package for signing
70+
if: runner.os == 'Windows' && env.SIGN_WINDOWS_WHEELS == 'true'
71+
run: python -m pip install wheel
72+
- name: Unpack khisto wheel
73+
if: runner.os == 'Windows' && env.SIGN_WINDOWS_WHEELS == 'true'
74+
run: |
75+
mkdir -p wheelhouse/unpacked
76+
python -m wheel unpack wheelhouse/khisto-*.whl --dest wheelhouse/unpacked
77+
- name: Setup SM_CLIENT_CERT_FILE from base64 secret data
78+
if: runner.os == 'Windows' && env.SIGN_WINDOWS_WHEELS == 'true'
79+
run: |
80+
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
81+
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
82+
- name: Sign unpacked wheel binaries
83+
if: runner.os == 'Windows' && env.SIGN_WINDOWS_WHEELS == 'true'
84+
uses: digicert/code-signing-software-trust-action@v1.2.1
85+
with:
86+
input: wheelhouse/unpacked/
87+
keypair-alias: ${{ env.KEYPAIR }}
88+
simple-signing-mode: true
89+
env:
90+
SM_HOST: ${{ secrets.SM_HOST }}
91+
SM_API_KEY: ${{ secrets.SM_API_KEY }}
92+
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
93+
- name: Repack signed wheels
94+
if: runner.os == 'Windows' && env.SIGN_WINDOWS_WHEELS == 'true'
95+
run: |
96+
rm wheelhouse/khisto-*.whl
97+
python -m wheel pack wheelhouse/unpacked/khisto-* --dest-dir wheelhouse
98+
- uses: actions/upload-artifact@v7
6399
with:
64100
name: pkg-wheel-${{ matrix.os }}
65101
path: wheelhouse/*.whl

0 commit comments

Comments
 (0)