Skip to content

Commit 4ae1942

Browse files
edyedy
authored andcommitted
fix(ci): revert invalid action version bumps in setup-bun
1 parent 00e82b2 commit 4ae1942

1 file changed

Lines changed: 2 additions & 39 deletions

File tree

.github/actions/setup-bun/action.yml

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,15 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11-
# node-gyp@latest (invoked via bunx for native install scripts) requires Node >=22;
12-
# some runner images ship an older system Node on PATH
1311
- name: Setup Node
1412
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1513
with:
1614
node-version: "24"
1715

18-
- name: Get baseline download URL
19-
id: bun-url
20-
shell: bash
21-
run: |
22-
if [ "$RUNNER_ARCH" = "X64" ]; then
23-
V=$(node -p "require('./package.json').packageManager.split('@')[1]")
24-
case "$RUNNER_OS" in
25-
macOS) OS=darwin ;;
26-
Linux) OS=linux ;;
27-
Windows) OS=windows ;;
28-
esac
29-
echo "url=https://github.com/oven-sh/bun/releases/download/bun-v${V}/bun-${OS}-x64-baseline.zip" >> "$GITHUB_OUTPUT"
30-
fi
31-
3216
- name: Setup Bun
3317
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
3418
with:
35-
bun-version-file: ${{ !steps.bun-url.outputs.url && 'package.json' || '' }}
36-
bun-download-url: ${{ steps.bun-url.outputs.url }}
19+
bun-version-file: package.json
3720

3821
- name: Get cache directory
3922
id: cache
@@ -49,42 +32,27 @@ runs:
4932
restore-keys: |
5033
${{ runner.os }}-bun-
5134
52-
- name: Install setuptools for distutils compatibility
53-
run: python3 -m pip install setuptools || pip install setuptools || true
54-
shell: bash
55-
5635
- name: Install dependencies (with retry)
5736
run: |
58-
# 重试机制:Bun 下载某些包时可能失败(特别是 dev/beta 版本)
59-
# 参考:https://github.com/oven-sh/bun/issues/xxxx
60-
6137
MAX_RETRIES=3
6238
RETRY_DELAY=5
63-
6439
for i in $(seq 1 $MAX_RETRIES); do
6540
echo "=== Install attempt $i/$MAX_RETRIES ==="
66-
67-
# 清理可能的损坏缓存
6841
if [ $i -gt 1 ]; then
69-
echo "Cleaning corrupted cache..."
42+
echo "Cleaning cache..."
7043
rm -rf node_modules/.bun node_modules
7144
bun pm cache rm || true
7245
fi
73-
74-
# 尝试安装(先用 frozen lockfile,失败则允许更新)
7546
INSTALL_CMD="bun install --frozen-lockfile ${{ inputs.install-flags }}"
7647
if [ "$i" = "$MAX_RETRIES" ]; then
7748
echo "Last attempt: allowing lockfile updates..."
7849
INSTALL_CMD="bun install ${{ inputs.install-flags }}"
7950
fi
80-
8151
if [ "$RUNNER_OS" = "Windows" ]; then
8252
$INSTALL_CMD --linker hoisted && break
8353
else
8454
$INSTALL_CMD && break
8555
fi
86-
87-
# 如果还有重试机会,等待后重试
8856
if [ $i -lt $MAX_RETRIES ]; then
8957
echo "Install failed, retrying in ${RETRY_DELAY}s..."
9058
sleep $RETRY_DELAY
@@ -93,14 +61,9 @@ runs:
9361
exit 1
9462
fi
9563
done
96-
9764
echo "✅ Dependencies installed successfully"
9865
shell: bash
9966

100-
- name: Dedupe packages
101-
run: bun run scripts/dedupe-keymap.ts
102-
shell: bash
103-
10467
- name: Save Bun dependencies
10568
if: steps.bun-cache.outputs.cache-hit != 'true' && github.event_name != 'pull_request' && github.event_name != 'pull_request_target'
10669
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0

0 commit comments

Comments
 (0)