Skip to content

Commit 5ff0120

Browse files
committed
Update to version 1.0.0-rc.2 on 2026-11-03
- The first release of the DocSpring CLI: a `docspring` command for every operation in DocSpring's API v2, such as `docspring templates list` and `docspring submissions create`, with `--json` output for scripts and AI agents. - `docspring login` logs in with your browser, and `docspring login --with-token` saves an API token. Profiles keep more than one account or region (`--profile`), and the tokens are kept in your system's keychain. Commands also read `DOCSPRING_TOKEN_ID` and `DOCSPRING_TOKEN_SECRET`, for CI. - `docspring submit` fills in a template and saves the PDF, or a Word template's Word document, and `docspring submissions download` saves a submission's PDF, Word document, audit trail or preview. - `docspring templates model-code --check` exits with status 5 when a file of generated types is out of date with its template, for CI. - `--all` gets every page of a list and prints all the items as one list. - `docspring exports download` saves the account export that DocSpring support sends when you ask for a copy of your account's data. - Request bodies are checked against the API's schemas before they're sent, so a mistyped property name fails with the same details as the API's 422 response. - Install it with Homebrew (`brew install docspring/tap/docspring`), the shell or PowerShell installer, `cargo install --locked docspring-cli`, or the `DocSpring/docspring-cli` GitHub Action. `docspring update` updates an install from the installers.
1 parent 3607ed0 commit 5ff0120

7 files changed

Lines changed: 132 additions & 10 deletions

File tree

‎.github/build-setup.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Steps that dist's release.yml runs in each build job before `dist build` (github-build-setup in dist-workspace.toml).
2+
# This file sits outside workflows/, where GitHub would read it as a broken workflow.
3+
4+
# Apple notarizes only binaries signed with the hardened runtime (notarize.yml). dist passes CODESIGN_OPTIONS to
5+
# codesign's --options when it signs the macOS binaries.
6+
- name: Sign macOS binaries with the hardened runtime
7+
if: runner.os == 'macOS'
8+
run: echo "CODESIGN_OPTIONS=runtime" >> "$GITHUB_ENV"

‎.github/workflows/notarize.yml‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Notarizes the macOS binaries with Apple. release.yml runs it after the binaries are built and signed, and publishes
2+
# the release only once it passes. Without notarization, macOS refuses to run a binary that was downloaded in a browser
3+
# ("Apple could not verify..."). A bare binary can't carry its notarization ticket (only apps, disk images and
4+
# installer packages can be stapled), so macOS looks the ticket up online, by the binary's code hash, the first time it
5+
# runs. Nothing here changes the archives.
6+
#
7+
# It signs in to Apple's notary service with an App Store Connect API key: the APPLE_NOTARY_KEY (the .p8 file's text),
8+
# APPLE_NOTARY_KEY_ID and APPLE_NOTARY_ISSUER_ID secrets (internal_docs/sdk-generation.md in DocSpring's monorepo).
9+
name: Notarize the macOS binaries
10+
11+
on:
12+
workflow_call:
13+
inputs:
14+
plan:
15+
required: true
16+
type: string
17+
18+
jobs:
19+
notarize:
20+
runs-on: macos-15
21+
timeout-minutes: 90
22+
steps:
23+
- name: Fetch the macOS builds
24+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
25+
with:
26+
pattern: artifacts-build-local-*-apple-darwin
27+
path: builds/
28+
merge-multiple: true
29+
- name: Notarize
30+
env:
31+
APPLE_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY }}
32+
APPLE_NOTARY_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }}
33+
APPLE_NOTARY_ISSUER_ID: ${{ secrets.APPLE_NOTARY_ISSUER_ID }}
34+
run: |
35+
set -euo pipefail
36+
for name in APPLE_NOTARY_KEY APPLE_NOTARY_KEY_ID APPLE_NOTARY_ISSUER_ID; do
37+
if [ -z "${!name}" ]; then
38+
echo "::error::The $name secret isn't set on this repository"
39+
exit 1
40+
fi
41+
done
42+
43+
shopt -s nullglob
44+
archives=(builds/docspring-cli-*-apple-darwin.tar.xz)
45+
if [ ${#archives[@]} -eq 0 ]; then
46+
echo "::error::No macOS archives in builds/: $(ls builds)"
47+
exit 1
48+
fi
49+
50+
# One submission with every macOS binary, each in a folder named after its target
51+
mkdir -p notarize
52+
for archive in "${archives[@]}"; do
53+
target=$(basename "$archive" .tar.xz)
54+
target=${target#docspring-cli-}
55+
mkdir -p "extracted/$target" "notarize/$target"
56+
tar -xJf "$archive" -C "extracted/$target"
57+
binary="extracted/$target/docspring-cli-$target/docspring"
58+
codesign --verify --strict --verbose=2 "$binary"
59+
# Apple refuses a binary without the hardened runtime (build-setup.yml asks dist's codesign for it)
60+
if ! codesign --display --verbose=2 "$binary" 2>&1 | grep -q '^CodeDirectory .*flags=0x[0-9a-f]*([^)]*runtime'; then
61+
echo "::error::$archive's binary isn't signed with the hardened runtime:"
62+
codesign --display --verbose=2 "$binary"
63+
exit 1
64+
fi
65+
cp "$binary" "notarize/$target/docspring"
66+
done
67+
ditto -c -k --keepParent notarize notarize.zip
68+
69+
key="$RUNNER_TEMP/notary_key.p8"
70+
printf '%s\n' "$APPLE_NOTARY_KEY" > "$key"
71+
auth=(--key "$key" --key-id "$APPLE_NOTARY_KEY_ID" --issuer "$APPLE_NOTARY_ISSUER_ID")
72+
73+
# notarytool's exit status alone doesn't say whether Apple accepted the binaries: the submission's status does
74+
set +e
75+
xcrun notarytool submit notarize.zip "${auth[@]}" --wait --timeout 1h --output-format json > submission.json
76+
submit_status=$?
77+
set -e
78+
cat submission.json
79+
id=$(jq -r '.id // empty' submission.json)
80+
status=$(jq -r '.status // empty' submission.json)
81+
if [ -n "$id" ]; then
82+
# Apple's report: lists any problems, and warnings even when it accepts the binaries
83+
xcrun notarytool log "$id" "${auth[@]}"
84+
fi
85+
if [ "$status" != Accepted ]; then
86+
echo "::error::Apple didn't notarize the binaries (notarytool exited $submit_status, status: ${status:-none}). Its report above says why."
87+
exit 1
88+
fi
89+
echo "Notarized: ${archives[*]}"

‎.github/workflows/release.yml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ jobs:
134134
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
135135
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
136136
fi
137+
- name: "Sign macOS binaries with the hardened runtime"
138+
if: "runner.os == 'macOS'"
139+
run: "echo \"CODESIGN_OPTIONS=runtime\" >> \"$GITHUB_ENV\""
137140
- name: Install dist
138141
run: ${{ matrix.install_dist.run }}
139142
# Get the dist-manifest
@@ -222,14 +225,26 @@ jobs:
222225
path: |
223226
${{ steps.cargo-dist.outputs.paths }}
224227
${{ env.BUILD_MANIFEST_NAME }}
228+
229+
custom-notarize:
230+
needs:
231+
- plan
232+
- build-local-artifacts
233+
uses: ./.github/workflows/notarize.yml
234+
with:
235+
plan: ${{ needs.plan.outputs.val }}
236+
secrets: inherit
237+
permissions:
238+
"contents": "read"
225239
# Determines if we should publish/announce
226240
host:
227241
needs:
228242
- plan
229243
- build-local-artifacts
230244
- build-global-artifacts
245+
- custom-notarize
231246
# Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
232-
if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
247+
if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.custom-notarize.result == 'skipped' || needs.custom-notarize.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
233248
env:
234249
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
235250
runs-on: "ubuntu-22.04"

‎Cargo.lock‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "docspring-cli"
3-
version = "1.0.0-rc.1"
3+
version = "1.0.0-rc.2"
44
edition = "2021"
55
rust-version = "1.88"
66
# Its own tests (cargo test in this directory) resolve dependencies that build with rust-version

‎action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ inputs:
1717
The version to install, such as 1.2.0, or latest. Default this action's own release, so
1818
DocSpring/docspring-cli@v1 installs the newest 1.x.
1919
required: false
20-
default: "1.0.0-rc.1"
20+
default: "1.0.0-rc.2"
2121
outputs:
2222
version:
2323
description: The version that was installed

‎dist-workspace.toml‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ installers = ["shell", "powershell", "homebrew"]
1111
tap = "DocSpring/homebrew-tap"
1212
formula = "docspring"
1313
publish-jobs = ["homebrew", "./publish-crates"]
14-
# A custom publish job gets only id-token and packages unless this says otherwise, and publish-crates.yml checks out
15-
# the repository; a called workflow can't ask for more than its caller grants
16-
github-custom-job-permissions = { "publish-crates" = { contents = "read", id-token = "write" } }
14+
# Notarizes the macOS binaries after they're built (.github/workflows/notarize.yml): the release is published only
15+
# once Apple accepts them
16+
global-artifacts-jobs = ["./notarize"]
17+
# Steps each build job runs before `dist build`: the hardened runtime for the macOS signatures, which notarization needs
18+
github-build-setup = "../build-setup.yml"
1719
# Linux builds use musl, so they run on any distribution
1820
targets = [
1921
"aarch64-apple-darwin",
@@ -29,10 +31,18 @@ install-updater = false
2931
checksum = "sha256"
3032
github-attestations = true
3133
# Signs the macOS binaries with DocSpring's Developer ID (CODESIGN_* secrets in the docspring-cli repo,
32-
# internal_docs/sdk-generation.md), so the keychain keeps trusting the CLI after each update
34+
# internal_docs/sdk-generation.md), so the keychain keeps trusting the CLI after each update. notarize.yml then
35+
# notarizes them.
3336
macos-sign = true
3437
pr-run-mode = "plan"
3538

39+
# A custom publish job gets only id-token and packages unless this says otherwise, and publish-crates.yml checks out
40+
# the repository; a called workflow can't ask for more than its caller grants. Without an entry, notarize would get
41+
# the workflow's own contents: write.
42+
[dist.github-custom-job-permissions]
43+
"publish-crates" = { contents = "read", id-token = "write" }
44+
"notarize" = { contents = "read" }
45+
3646
# Every action in release.yml pinned to a commit, with its version in a comment (the comment goes into the workflow
3747
# as written): the same commits as the SDKs' release workflows (api_clients/github_workflows/), which
3848
# spec/api_clients/github_workflows_spec.rb checks. A new action that dist adds needs a line here.

0 commit comments

Comments
 (0)