Skip to content

Commit 73c295d

Browse files
committed
chore: pin Bun version via .bun-version (#69)
Replace deploy.sh's `bun upgrade` with a pinned install driven by the new `.bun-version` file (currently 1.3.6), and point every CI `setup-bun` step at the same file via `bun-version-file`. Dev, CI, and prod now stay in lockstep, and a Bun release can't reach the host without first being vetted in CI.
1 parent 17f3cfb commit 73c295d

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

.bun-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.3.6

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2020
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
21+
with:
22+
bun-version-file: .bun-version
2123

2224
- name: Install Dependencies
2325
run: bun install --frozen-lockfile
@@ -29,6 +31,8 @@ jobs:
2931
steps:
3032
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3133
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
34+
with:
35+
bun-version-file: .bun-version
3236

3337
- name: Install Dependencies
3438
run: bun install --frozen-lockfile
@@ -44,6 +48,8 @@ jobs:
4448
steps:
4549
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
4650
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
51+
with:
52+
bun-version-file: .bun-version
4753

4854
- name: Install Dependencies
4955
run: bun install --frozen-lockfile
@@ -74,6 +80,8 @@ jobs:
7480
steps:
7581
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
7682
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
83+
with:
84+
bun-version-file: .bun-version
7785

7886
- name: Install Dependencies
7987
run: bun install --frozen-lockfile
@@ -85,6 +93,8 @@ jobs:
8593
steps:
8694
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
8795
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
96+
with:
97+
bun-version-file: .bun-version
8898

8999
- name: Install Dependencies
90100
run: bun install --frozen-lockfile

scripts/deploy.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,20 @@ set -euo pipefail
1010
# `bun` and `pm2` resolve regardless of how this script was invoked.
1111
export PATH="$HOME/.bun/bin:$HOME/.local/bin:/usr/local/bin:$PATH"
1212

13-
# Keep the host's Bun current. Lockfiles are written by recent Bun in dev
14-
# and CI; an older host Bun fails to parse them ("Outdated lockfile
15-
# version"). `bun upgrade` is idempotent and safe when already current.
16-
bun upgrade
13+
# Pin the host's Bun to the version recorded in `.bun-version`. CI uses
14+
# the same file via `oven-sh/setup-bun`, so dev/CI/prod stay in lockstep
15+
# and we never silently pull a Bun release that hasn't been vetted in CI
16+
# first. If `.bun-version` is absent (e.g. when running this script from
17+
# a stale checkout) we fall back to the currently installed Bun.
18+
PIN="$(cat .bun-version 2>/dev/null | tr -d '[:space:]')"
19+
if [ -n "$PIN" ]; then
20+
if [ "$(bun --version 2>/dev/null)" != "$PIN" ]; then
21+
echo "Pinning Bun to $PIN (current: $(bun --version 2>/dev/null || echo none))"
22+
curl -fsSL https://bun.sh/install | bash -s "bun-v$PIN"
23+
fi
24+
else
25+
echo "WARNING: .bun-version missing; using installed Bun $(bun --version)"
26+
fi
1727

1828
BACKUPS_DIR="prisma/backups"
1929
KEEP_BACKUPS=3

0 commit comments

Comments
 (0)