Skip to content

Commit 49777b2

Browse files
ankrgylviadezo1er
andauthored
sign windows builds
Update cargo dist to use the new dist-workspace.toml file --------- Co-authored-by: Cédric Halber <cedric@braintrustdata.com>
1 parent 3140fd4 commit 49777b2

5 files changed

Lines changed: 102 additions & 26 deletions

File tree

.github/workflows/release-canary.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: Install dist
5050
shell: bash
51-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3/cargo-dist-installer.sh | sh"
51+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.31.0/cargo-dist-installer.sh | sh"
5252

5353
- name: Cache dist
5454
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -113,6 +113,7 @@ jobs:
113113
env:
114114
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115115
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
116+
HAS_SSLDOTCOM_SIGNING: ${{ secrets.SSLDOTCOM_USERNAME != '' && secrets.SSLDOTCOM_PASSWORD != '' && secrets.SSLDOTCOM_CREDENTIAL_ID != '' && secrets.SSLDOTCOM_TOTP_SECRET != '' }}
116117
steps:
117118
- name: Enable windows longpaths
118119
run: git config --global core.longpaths true
@@ -152,6 +153,31 @@ jobs:
152153
- name: Install dependencies
153154
run: ${{ matrix.packages_install }}
154155

156+
- name: Configure SSL.com signing env
157+
if: ${{ runner.os == 'Windows' && env.HAS_SSLDOTCOM_SIGNING == 'true' }}
158+
shell: bash
159+
env:
160+
SSLDOTCOM_USERNAME: ${{ secrets.SSLDOTCOM_USERNAME }}
161+
SSLDOTCOM_PASSWORD: ${{ secrets.SSLDOTCOM_PASSWORD }}
162+
SSLDOTCOM_CREDENTIAL_ID: ${{ secrets.SSLDOTCOM_CREDENTIAL_ID }}
163+
SSLDOTCOM_TOTP_SECRET: ${{ secrets.SSLDOTCOM_TOTP_SECRET }}
164+
run: |
165+
write_github_env() {
166+
local key="$1"
167+
local value="$2"
168+
local delimiter="EOF_${key}_$$"
169+
{
170+
echo "${key}<<${delimiter}"
171+
echo "${value}"
172+
echo "${delimiter}"
173+
} >> "$GITHUB_ENV"
174+
}
175+
176+
write_github_env "SSLDOTCOM_USERNAME" "$SSLDOTCOM_USERNAME"
177+
write_github_env "SSLDOTCOM_PASSWORD" "$SSLDOTCOM_PASSWORD"
178+
write_github_env "SSLDOTCOM_CREDENTIAL_ID" "$SSLDOTCOM_CREDENTIAL_ID"
179+
write_github_env "SSLDOTCOM_TOTP_SECRET" "$SSLDOTCOM_TOTP_SECRET"
180+
155181
- name: Build artifacts
156182
shell: bash
157183
run: |

.github/workflows/release.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363

6464
- name: Install dist
6565
shell: bash
66-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3/cargo-dist-installer.sh | sh"
66+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.31.0/cargo-dist-installer.sh | sh"
6767

6868
- name: Cache dist
6969
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -98,6 +98,7 @@ jobs:
9898
env:
9999
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100100
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
101+
HAS_SSLDOTCOM_SIGNING: ${{ secrets.SSLDOTCOM_USERNAME != '' && secrets.SSLDOTCOM_PASSWORD != '' && secrets.SSLDOTCOM_CREDENTIAL_ID != '' && secrets.SSLDOTCOM_TOTP_SECRET != '' }}
101102
steps:
102103
- name: Enable windows longpaths
103104
run: git config --global core.longpaths true
@@ -137,6 +138,31 @@ jobs:
137138
- name: Install dependencies
138139
run: ${{ matrix.packages_install }}
139140

141+
- name: Configure SSL.com signing env
142+
if: ${{ runner.os == 'Windows' && env.HAS_SSLDOTCOM_SIGNING == 'true' }}
143+
shell: bash
144+
env:
145+
SSLDOTCOM_USERNAME: ${{ secrets.SSLDOTCOM_USERNAME }}
146+
SSLDOTCOM_PASSWORD: ${{ secrets.SSLDOTCOM_PASSWORD }}
147+
SSLDOTCOM_CREDENTIAL_ID: ${{ secrets.SSLDOTCOM_CREDENTIAL_ID }}
148+
SSLDOTCOM_TOTP_SECRET: ${{ secrets.SSLDOTCOM_TOTP_SECRET }}
149+
run: |
150+
write_github_env() {
151+
local key="$1"
152+
local value="$2"
153+
local delimiter="EOF_${key}_$$"
154+
{
155+
echo "${key}<<${delimiter}"
156+
echo "${value}"
157+
echo "${delimiter}"
158+
} >> "$GITHUB_ENV"
159+
}
160+
161+
write_github_env "SSLDOTCOM_USERNAME" "$SSLDOTCOM_USERNAME"
162+
write_github_env "SSLDOTCOM_PASSWORD" "$SSLDOTCOM_PASSWORD"
163+
write_github_env "SSLDOTCOM_CREDENTIAL_ID" "$SSLDOTCOM_CREDENTIAL_ID"
164+
write_github_env "SSLDOTCOM_TOTP_SECRET" "$SSLDOTCOM_TOTP_SECRET"
165+
140166
- name: Build artifacts
141167
shell: bash
142168
run: |

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,14 @@ Notes:
123123

124124
- The workflow publishes an immutable tag: `canary-<branch-slug>-<short-sha>`.
125125
- It also updates a moving branch tag: `canary-<branch-slug>` when the run is for the latest commit on that branch.
126+
127+
## Windows Release Signing
128+
129+
Release and canary workflows can Authenticode-sign Windows artifacts when these GitHub Actions repository secrets are configured:
130+
131+
- `SSLDOTCOM_USERNAME`
132+
- `SSLDOTCOM_PASSWORD`
133+
- `SSLDOTCOM_CREDENTIAL_ID`
134+
- `SSLDOTCOM_TOTP_SECRET`
135+
136+
If those secrets are absent, `cargo-dist` skips Windows signing and the published `bt.exe` remains unsigned.

Cargo.toml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ description = "The Braintrust command line interface"
88
license = "Apache-2.0"
99
repository = "https://github.com/braintrustdata/bt"
1010

11+
[package.metadata.wix]
12+
upgrade-guid = "5B558F98-EEBD-4F5E-A0C8-E7A039445139"
13+
path-guid = "7CD3044D-A62A-469C-8552-0E5C3A00FFF1"
14+
license = false
15+
eula = false
16+
1117
[dependencies]
1218
actix-web = "4.11.0"
1319
anyhow = "1.0.89"
@@ -49,30 +55,6 @@ lto = "thin"
4955
[workspace]
5056
members = ["."]
5157

52-
[workspace.metadata.dist]
53-
cargo-dist-version = "0.30.3"
54-
ci = "github"
55-
create-release = true
56-
pr-run-mode = "plan"
57-
allow-dirty = ["ci"]
58-
59-
[package.metadata.dist]
60-
installers = ["shell", "powershell"]
61-
targets = [
62-
"aarch64-apple-darwin",
63-
"x86_64-apple-darwin",
64-
"aarch64-unknown-linux-gnu",
65-
"x86_64-unknown-linux-gnu",
66-
"aarch64-unknown-linux-musl",
67-
"x86_64-unknown-linux-musl",
68-
"x86_64-pc-windows-msvc",
69-
]
70-
unix-archive = ".tar.gz"
71-
windows-archive = ".zip"
72-
install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"]
73-
install-updater = true
74-
install-success-msg = ""
75-
7658
[dev-dependencies]
7759
tempfile = "3"
7860
assert_cmd = "2.2.0"

dist-workspace.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[workspace]
2+
members = ["cargo:."]
3+
4+
# Config for 'dist'
5+
[dist]
6+
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
7+
cargo-dist-version = "0.31.0"
8+
# CI backends to support
9+
ci = "github"
10+
# Whether dist should create a Github Release or use an existing draft
11+
create-release = true
12+
# Which actions to run on pull requests
13+
pr-run-mode = "plan"
14+
# Skip checking whether the specified configuration files are up to date
15+
allow-dirty = ["ci"]
16+
ssldotcom-windows-sign = "test"
17+
# The installers to generate for each app
18+
installers = ["shell", "powershell", "homebrew"]
19+
homepage = "https://github.com/braintrustdata/bt"
20+
# Target platforms to build apps for (Rust target-triple syntax)
21+
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
22+
# The archive format to use for non-windows builds (defaults .tar.xz)
23+
unix-archive = ".tar.gz"
24+
# The archive format to use for windows builds (defaults .zip)
25+
windows-archive = ".zip"
26+
# Path that installers should place binaries in
27+
install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"]
28+
# Whether to install an updater program
29+
install-updater = true
30+
# Custom message to display on successful install
31+
install-success-msg = ""

0 commit comments

Comments
 (0)