@@ -15,23 +15,6 @@ permissions:
1515 contents : read
1616
1717jobs :
18- changes :
19- runs-on : ubuntu-latest
20- outputs :
21- site : ${{ steps.filter.outputs.site }}
22- steps :
23- - uses : actions/checkout@v4
24- - uses : dorny/paths-filter@v3
25- id : filter
26- with :
27- token : ${{ github.token }}
28- filters : |
29- site:
30- - 'apps/site/**'
31- - 'pnpm-lock.yaml'
32- - 'package.json'
33- - 'pnpm-workspace.yaml'
34-
3518 cli :
3619 runs-on : ubuntu-latest
3720 steps :
@@ -41,44 +24,42 @@ jobs:
4124 uses : actions/setup-node@v4
4225 with :
4326 node-version : 20
44- cache : pnpm
45-
46- - name : enable corepack (pnpm)
47- run : |
48- corepack enable
49- corepack prepare pnpm@9 --activate
50- pnpm -v
27+ cache : ' npm'
5128
5229 - name : install
53- run : pnpm install --frozen-lockfile
30+ run : npm ci
5431
5532 - name : typecheck
56- run : pnpm -w -r run typecheck || echo "no typecheck script "
33+ run : npm run -ws --if-present typecheck || echo "no typecheck"
5734
5835 - name : build (if any)
59- run : pnpm -w -r run build || echo "no build scripts "
36+ run : npm run -ws --if-present build || echo "no build"
6037
6138 - name : test
6239 env :
6340 CI : true
64- run : pnpm -w -r test
41+ run : npm run -ws --if-present test
6542
43+ # demo: use tsx to run the CLI directly
6644 - name : nectar demo (plan + diff + render)
6745 run : |
68- pnpm nectar codemod \
69- --fixture examples/nectar-demo/manifest/build-manifest.json \
70- --sizes examples/nectar-demo/manifest/sizes.json \
71- --json > /dev/null
72-
73- pnpm nectar codemod \
74- --fixture examples/nectar-demo/manifest/build-manifest.json \
75- --sizes examples/nectar-demo/manifest/sizes.json \
76- --diff --diff-out .nectar/diff.patch
77-
78- pnpm nectar render --format comment \
79- --plan .nectar/plan.json \
80- --diff .nectar/diff.patch \
81- --out .nectar/comment.md
46+ npm run nectar -- \
47+ codemod \
48+ --fixture examples/nectar-demo/manifest/build-manifest.json \
49+ --sizes examples/nectar-demo/manifest/sizes.json \
50+ --json > /dev/null
51+
52+ npm run nectar -- \
53+ codemod \
54+ --fixture examples/nectar-demo/manifest/build-manifest.json \
55+ --sizes examples/nectar-demo/manifest/sizes.json \
56+ --diff --diff-out .nectar/diff.patch
57+
58+ npm run nectar -- \
59+ render --format comment \
60+ --plan .nectar/plan.json \
61+ --diff .nectar/diff.patch \
62+ --out .nectar/comment.md
8263
8364 - name : upload nectar artifacts
8465 if : always()
@@ -92,34 +73,36 @@ jobs:
9273 if-no-files-found : ignore
9374 retention-days : 7
9475
76+ # optional: build docs site only when it changes
9577 site :
96- needs : changes
97- if : needs.changes.outputs.site == 'true'
9878 runs-on : ubuntu-latest
79+ if : ${{ !cancelled() }}
9980 steps :
10081 - uses : actions/checkout@v4
101-
82+ - uses : dorny/paths-filter@v3
83+ id : filter
84+ with :
85+ token : ${{ github.token }}
86+ filters : |
87+ site:
88+ - 'apps/site/**'
89+ - 'package.json'
90+ - 'package-lock.json'
10291 - name : setup node
92+ if : steps.filter.outputs.site == 'true'
10393 uses : actions/setup-node@v4
10494 with :
10595 node-version : 20
106- cache : pnpm
107-
108- - name : enable corepack (pnpm)
109- run : |
110- corepack enable
111- corepack prepare pnpm@9 --activate
112- pnpm -v
113-
96+ cache : ' npm'
11497 - name : install
115- run : pnpm install --frozen-lockfile
116-
98+ if : steps.filter.outputs.site == 'true'
99+ run : npm ci
117100 - name : build site
101+ if : steps.filter.outputs.site == 'true'
118102 working-directory : apps/site
119- run : pnpm build
120-
103+ run : npm run build --if-present
121104 - name : upload site build
122- if : always()
105+ if : always() && steps.filter.outputs.site == 'true'
123106 uses : actions/upload-artifact@v4
124107 with :
125108 name : site-build
0 commit comments