@@ -222,13 +222,71 @@ jobs:
222222 npm test
223223 '
224224
225+ dry-run-publish :
226+ name : Dry Run Publish
227+ runs-on : ubuntu-latest
228+ if : github.event_name == 'pull_request'
229+ needs :
230+ - build
231+ - test
232+ steps :
233+ - uses : actions/checkout@v4
234+ with :
235+ submodules : recursive
236+ fetch-depth : 0
237+
238+ - name : Setup node
239+ uses : actions/setup-node@v4
240+ with :
241+ node-version : 18
242+ check-latest : true
243+ cache : npm
244+
245+ - name : Cache NPM dependencies
246+ uses : actions/cache@v4
247+ with :
248+ path : node_modules
249+ key : npm-cache-ubuntu-latest-${{ hashFiles('package-lock.json') }}
250+
251+ - name : Install dependencies
252+ run : npm ci
253+
254+ - name : Download artifact
255+ uses : actions/download-artifact@v4
256+ with :
257+ name : bindings-aarch64-apple-darwin
258+
259+ - name : Move artifacts
260+ run : |
261+ mkdir -p dist
262+ find . -type f -name 'cel-typescript.*.node' -exec mv {} . \;
263+
264+ - name : List files
265+ run : |
266+ echo "Root directory:"
267+ ls -la
268+ echo "\nNode files:"
269+ find . -maxdepth 1 -name '*.node'
270+ shell : bash
271+
272+ - name : Link local package
273+ run : npm link
274+
275+ - name : Build TypeScript
276+ run : npm run build:ts
277+
278+ - name : Verify package contents
279+ run : |
280+ echo "Package contents:"
281+ npm pack --dry-run
282+
225283 publish :
226- name : Publish
284+ name : ${{ github.event_name == 'pull_request' && ' Publish (Dry Run)' || 'Publish' }}
227285 runs-on : ubuntu-latest
228286 permissions :
229287 contents : read
230288 id-token : write
231- if : startsWith(github.ref, 'refs/tags/v')
289+ if : startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request'
232290 needs :
233291 - build
234292 - test
@@ -293,11 +351,16 @@ jobs:
293351 npm pack --dry-run
294352
295353 - name : Configure npm
354+ if : github.event_name != 'pull_request'
296355 run : |
297356 echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
298357
299358 - name : Publish
300- if : env.NPM_TOKEN != ''
359+ if : github.event_name != 'pull_request' && env.NPM_TOKEN != ''
301360 env :
302361 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
303362 run : npm publish --access public --provenance
363+
364+ - name : Dry Run Publish
365+ if : github.event_name == 'pull_request'
366+ run : npm publish --dry-run
0 commit comments