-
Notifications
You must be signed in to change notification settings - Fork 455
61 lines (48 loc) · 1.8 KB
/
Copy pathpublish-any-commit.yml
File metadata and controls
61 lines (48 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Publish Any Commit
on: [push, pull_request]
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: pnpm/action-setup@v5
- uses: actions/setup-node@v5
with:
node-version: 22.18.0
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
# Bake the preview's own immutable pkg.pr.new URL into the build so the
# shipped skill's `npx` commands and `react-doctor install` reference this
# exact commit — a beta tester then exercises the previewed branch instead
# of silently falling back to the published `react-doctor@latest`.
- run: pnpm build
env:
REACT_DOCTOR_PACKAGE_SPECIFIER: https://pkg.pr.new/react-doctor@${{ github.sha }}
- name: Publish packages (retry on transient failures)
run: |
max_attempts=4
attempt=1
while [ "$attempt" -le "$max_attempts" ]; do
if pnpm dlx pkg-pr-new publish \
./packages/react-doctor \
./packages/oxlint-plugin-react-doctor \
./packages/eslint-plugin-react-doctor; then
exit 0
fi
if [ "$attempt" -eq "$max_attempts" ]; then
exit 1
fi
sleep_seconds=$((2 ** attempt))
echo "pkg-pr-new publish failed on attempt ${attempt}/${max_attempts}; retrying in ${sleep_seconds}s..."
sleep "$sleep_seconds"
attempt=$((attempt + 1))
done