Skip to content

Commit 6a0ddd8

Browse files
authored
Simplify release build pipeline (#4900)
## Summary - Consolidate `.goreleaser-unix.yaml` and `.goreleaser-windows.yaml` into a single `.goreleaser.yaml` - Remove Docker build/push from goreleaser (to be handled separately) - Sign Windows binaries using jsign on Linux, replacing azuresigntool which required a Windows runner - Add `release-build.yml` workflow that builds all platforms and the Python wheel in parallel ## Test plan - [x] Verify `release-build` workflow succeeds on push to branch - [x] Verify Windows binary signatures in CI logs This pull request was AI-assisted by Isaac.
1 parent f5c0d62 commit 6a0ddd8

File tree

5 files changed

+181
-211
lines changed

5 files changed

+181
-211
lines changed

.github/scripts/sign-windows.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Sign a Windows binary using jsign with Azure Key Vault.
4+
# Called as a goreleaser post-hook for every built binary.
5+
#
6+
# Skips signing when:
7+
# - The binary is not a .exe (unix builds)
8+
# - Not running in CI (local builds)
9+
#
10+
# Expected environment variables (set by the "cli" job in release-build.yml):
11+
# JSIGN_JAR - Path to the jsign jar file
12+
# AZURE_VAULT_TOKEN - Azure Key Vault access token
13+
#
14+
# https://github.com/ebourg/jsign
15+
16+
set -euo pipefail
17+
18+
binary="$1"
19+
20+
# Skip non-Windows binaries.
21+
[[ "$binary" == *.exe ]] || exit 0
22+
23+
# Skip when not running in CI.
24+
[[ "${CI:-}" == "true" ]] || exit 0
25+
26+
# Verify required environment variables.
27+
if [[ -z "${JSIGN_JAR:-}" ]]; then
28+
echo "ERROR: JSIGN_JAR is not set" >&2
29+
exit 1
30+
fi
31+
if [[ -z "${AZURE_VAULT_TOKEN:-}" ]]; then
32+
echo "ERROR: AZURE_VAULT_TOKEN is not set" >&2
33+
exit 1
34+
fi
35+
36+
java -jar "${JSIGN_JAR}" \
37+
--storetype AZUREKEYVAULT \
38+
--keystore deco-sign \
39+
--storepass "${AZURE_VAULT_TOKEN}" \
40+
--alias deco-sign \
41+
--tsaurl http://timestamp.digicert.com \
42+
--tsmode RFC3161 \
43+
"$binary"
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: release-build
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
branches:
8+
- "main"
9+
- "split-release-workflows"
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
cli:
15+
environment:
16+
name: sign
17+
deployment: false
18+
runs-on:
19+
group: databricks-protected-runner-group-large
20+
labels: linux-ubuntu-latest-large
21+
22+
permissions:
23+
id-token: write
24+
contents: read
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
with:
30+
fetch-depth: 0
31+
fetch-tags: true
32+
33+
- name: Setup JFrog
34+
uses: ./.github/actions/setup-jfrog
35+
36+
- name: Setup Go
37+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
38+
with:
39+
go-version-file: go.mod
40+
cache-dependency-path: |
41+
go.sum
42+
.goreleaser.yaml
43+
44+
- name: Download Go modules
45+
run: go mod download
46+
47+
- name: Setup Java
48+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
49+
with:
50+
distribution: temurin
51+
java-version: '21'
52+
53+
# jsign 7.4 from https://github.com/ebourg/jsign/releases/tag/7.4
54+
- name: Download and verify jsign
55+
run: |
56+
curl -sfL -o "$RUNNER_TEMP/jsign.jar" \
57+
https://github.com/ebourg/jsign/releases/download/7.4/jsign-7.4.jar
58+
echo "2abf2ade9ea322acc2d60c24794eadc465ff9380938fca4c932d09e0b25f1c28 $RUNNER_TEMP/jsign.jar" | sha256sum -c -
59+
echo "JSIGN_JAR=$RUNNER_TEMP/jsign.jar" >> $GITHUB_ENV
60+
61+
- name: Get Azure Key Vault access token
62+
run: |
63+
TOKEN=$(curl -sf -X POST \
64+
"https://login.microsoftonline.com/${{ secrets.DECO_SIGN_AZURE_TENANT_ID }}/oauth2/v2.0/token" \
65+
-d "client_id=${{ secrets.DECO_SIGN_AZURE_CLIENT_ID }}" \
66+
-d "client_secret=${{ secrets.DECO_SIGN_AZURE_CLIENT_SECRET }}" \
67+
-d "scope=https://vault.azure.net/.default" \
68+
-d "grant_type=client_credentials" | jq -r '.access_token')
69+
echo "::add-mask::$TOKEN"
70+
echo "AZURE_VAULT_TOKEN=$TOKEN" >> $GITHUB_ENV
71+
72+
- name: Hide snapshot tag to outsmart GoReleaser
73+
run: git tag -d snapshot || true
74+
75+
# Use --snapshot for branch builds (non-tag refs).
76+
- name: Run GoReleaser
77+
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0
78+
with:
79+
version: v2.14.3
80+
args: release --skip=publish ${{ !startsWith(github.ref, 'refs/tags/') && '--snapshot' || '' }}
81+
82+
- name: Verify Windows binary signatures
83+
run: |
84+
for exe in dist/*_windows_*/databricks.exe; do
85+
echo "=== $exe ==="
86+
java -jar "$JSIGN_JAR" extract --format PEM "$exe"
87+
openssl pkcs7 -in "${exe}.sig.pem" -inform PEM -print_certs -text -noout
88+
rm "${exe}.sig.pem"
89+
echo
90+
done
91+
92+
- name: Upload artifacts
93+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
94+
with:
95+
name: cli
96+
path: |
97+
dist/*.zip
98+
dist/*.tar.gz
99+
dist/*SHA256SUMS*
100+
101+
wheel:
102+
runs-on:
103+
group: databricks-protected-runner-group-large
104+
labels: linux-ubuntu-latest-large
105+
106+
permissions:
107+
id-token: write
108+
contents: read
109+
110+
steps:
111+
- name: Checkout repository
112+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
113+
with:
114+
fetch-depth: 0
115+
fetch-tags: true
116+
117+
- name: Setup JFrog
118+
uses: ./.github/actions/setup-jfrog
119+
120+
- name: Install uv
121+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
122+
with:
123+
version: "0.6.5"
124+
125+
- name: Build wheel
126+
working-directory: python
127+
run: make build
128+
129+
- name: Upload Python wheel
130+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
131+
with:
132+
name: wheel
133+
path: python/dist/*

.goreleaser-unix.yaml

Lines changed: 0 additions & 103 deletions
This file was deleted.

.goreleaser-windows.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)