Skip to content

Commit c0eba9e

Browse files
stefanhuberclaude
andauthored
fix(ci): isolate test job from publish to avoid clobbered dist (#49)
Split release workflow into test → release → storybook jobs so the release job no longer runs `npm test`. The `stencil-test` binary from @stencil/vitest runs `stencil build --dev` before tests, which overwrote the prod dist produced by the prior build step and left the published tarball missing `dist/esm/`, `dist/cjs/`, `dist/collection/`, `dist/index.{js,cjs.js}`, and `dist/components/*.js` — the root cause of the broken 0.7.0 publish of @smartcompanion/ui. Also tightens permissions to least-privilege per job and adds a lint gate to the tag-push pipeline (tags are excluded from ci.yml). Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent af14b10 commit c0eba9e

1 file changed

Lines changed: 36 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,41 @@ on:
66
- "v[0-9]+.[0-9]+.[0-9]+"
77

88
permissions:
9-
contents: write
10-
pages: write
11-
id-token: write
9+
contents: read
1210

1311
jobs:
12+
test:
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '22'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Install Playwright browsers
27+
run: npx playwright install chromium
28+
29+
- name: Build packages
30+
run: npm run build
31+
32+
- name: Run lint
33+
run: npm run lint
34+
35+
- name: Run tests
36+
run: npm test
37+
1438
release:
39+
needs: test
1540
runs-on: ubuntu-24.04
41+
permissions:
42+
contents: write
43+
id-token: write
1644
steps:
1745
- name: Checkout code
1846
uses: actions/checkout@v4
@@ -38,12 +66,6 @@ jobs:
3866
- name: Build packages
3967
run: npm run build
4068

41-
- name: Install Playwright browsers
42-
run: npx playwright install chromium
43-
44-
- name: Run tests
45-
run: npm test
46-
4769
- name: Publish all packages
4870
env:
4971
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -56,7 +78,7 @@ jobs:
5678
fi
5779
done
5880
59-
- name: Add package.json changes to git
81+
- name: Commit and push version bump
6082
run: |
6183
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
6284
git config user.name "github-actions[bot]"
@@ -70,6 +92,10 @@ jobs:
7092
storybook:
7193
needs: release
7294
runs-on: ubuntu-24.04
95+
permissions:
96+
contents: read
97+
pages: write
98+
id-token: write
7399
environment:
74100
name: github-pages
75101
url: ${{ steps.deployment.outputs.page_url }}

0 commit comments

Comments
 (0)