Skip to content

Commit fb3d07c

Browse files
committed
fix: consolidate CI workflows and add provenance permissions
- Merge CI and publish workflows into single comprehensive workflow - Add id-token: write permission for npm provenance generation - Add contents: read permission for repository access - Remove redundant publish.yml workflow - Ensure publish job runs only after CI passes (needs: ci) - Clean up workflow structure and naming
1 parent cfec12f commit fb3d07c

File tree

2 files changed

+85
-84
lines changed

2 files changed

+85
-84
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,98 @@
1-
name: CI
1+
name: CI & Publish
22

33
on:
44
push:
55
branches: [main]
6+
tags: ['v*']
67
pull_request:
78
branches: [main]
89

10+
permissions:
11+
id-token: write
12+
contents: read
13+
914
jobs:
10-
build-test:
15+
ci:
1116
runs-on: ubuntu-latest
1217
steps:
13-
- uses: actions/checkout@v4
14-
- uses: pnpm/action-setup@v4
15-
- uses: actions/setup-node@v4
18+
- name: Checkout Repo
19+
uses: actions/checkout@v4
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
1626
with:
1727
node-version: 20
1828
cache: 'pnpm'
19-
- run: pnpm install --frozen-lockfile
20-
- run: pnpm run lint
21-
- run: pnpm run build
22-
- run: pnpm run test -- --run
23-
- run: pnpm run check:publint
24-
- run: pnpm run check:attw
25-
- run: pnpm run check:size
29+
30+
- name: Install Dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Lint
34+
run: pnpm run lint
35+
36+
- name: Build Package
37+
run: pnpm run build
38+
39+
- name: Run Tests
40+
run: pnpm run test -- --run
41+
42+
- name: Run Tests with Coverage
43+
run: pnpm run test:coverage
44+
env:
45+
VITE_FIGMA_TOKEN: ${{ secrets.VITE_FIGMA_TOKEN }}
46+
VITE_FIGMA_FILE_KEY: ${{ secrets.VITE_FIGMA_FILE_KEY }}
47+
48+
- name: Upload Coverage Report (GitHub Artifact)
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: coverage-report
52+
path: coverage/
53+
54+
- name: Upload to Codecov
55+
uses: codecov/codecov-action@v5
56+
with:
57+
token: ${{ secrets.CODECOV_TOKEN }}
58+
files: ./coverage/lcov.info
59+
flags: unittests
60+
name: codecov-coverage
61+
fail_ci_if_error: true
62+
63+
- name: Check Publint
64+
run: pnpm run check:publint
65+
66+
- name: Check ATTW
67+
run: pnpm run check:attw
68+
69+
- name: Check Size
70+
run: pnpm run check:size
71+
72+
publish:
73+
if: startsWith(github.ref, 'refs/tags/v')
74+
runs-on: ubuntu-latest
75+
needs: ci
76+
steps:
77+
- name: Checkout Repo
78+
uses: actions/checkout@v4
79+
80+
- name: Setup Node
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: '20'
84+
registry-url: 'https://registry.npmjs.org/'
85+
86+
- name: Install pnpm
87+
uses: pnpm/action-setup@v4
88+
89+
- name: Install Dependencies
90+
run: pnpm install --frozen-lockfile
91+
92+
- name: Build Package
93+
run: pnpm run build
94+
95+
- name: Publish to NPM
96+
run: pnpm publish --access public --no-git-checks
97+
env:
98+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)