Skip to content

Commit 81a2f47

Browse files
committed
Split keyring binding fetch into its own step and drop comment
Self-documenting step names (Install / Fetch keyring native bindings / Build) replace the comment; read the version with bun instead of sed.
1 parent 9ac6a48 commit 81a2f47

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

templates/cli/.github/workflows/publish.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ jobs:
4343
sudo make
4444
sudo make install
4545
46-
- name: Install dependencies and build for Linux and Windows
46+
- name: Install dependencies
47+
run: bun install --frozen-lockfile
48+
49+
- name: Fetch keyring native bindings for all targets
4750
run: |
48-
bun install --frozen-lockfile
49-
# @napi-rs/keyring ships its native binding as os/cpu-gated platform
50-
# packages, so `bun install` only fetches the host's. bun --compile
51-
# embeds a binding only when its platform package is present on disk, so
52-
# fetch the rest before cross-compiling; otherwise those binaries
53-
# silently fall back to plaintext credential storage.
54-
KEYRING_VERSION="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' node_modules/@napi-rs/keyring/package.json | head -1)"
51+
version="$(bun -e 'console.log(require("@napi-rs/keyring/package.json").version)')"
5552
for triple in darwin-arm64 darwin-x64 linux-x64-gnu linux-arm64-gnu win32-x64-msvc win32-arm64-msvc; do
56-
dir="node_modules/@napi-rs/keyring-${triple}"
57-
ls "${dir}"/*.node >/dev/null 2>&1 && continue
58-
mkdir -p "${dir}"
59-
curl -fsSL "https://registry.npmjs.org/@napi-rs/keyring-${triple}/-/keyring-${triple}-${KEYRING_VERSION}.tgz" | tar -xz -C "${dir}" --strip-components=1
53+
dir="node_modules/@napi-rs/keyring-$triple"
54+
[ -d "$dir" ] && continue
55+
mkdir -p "$dir"
56+
curl -fsSL "https://registry.npmjs.org/@napi-rs/keyring-$triple/-/keyring-$triple-$version.tgz" | tar -xz -C "$dir" --strip-components=1
6057
done
58+
59+
- name: Build for Linux and Windows
60+
run: |
6161
bun run linux-x64
6262
bun run linux-arm64
6363
bun run mac-x64

0 commit comments

Comments
 (0)