Skip to content

Commit a06476c

Browse files
authored
add verify-published (#25)
1 parent 205aa3d commit a06476c

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Verify Published Package
2+
3+
on:
4+
workflow_run:
5+
workflows: ['Release']
6+
types:
7+
- completed
8+
9+
jobs:
10+
verify-published:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Setup Node
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
registry-url: https://registry.npmjs.org
20+
21+
- name: Wait for npm package availability
22+
run: node -e "setTimeout(() => process.exit(0), 60000)"
23+
24+
- name: Resolve latest published version
25+
id: pkg
26+
run: echo "version=$(npm view @dfsync/client version)" >> $GITHUB_OUTPUT
27+
28+
- name: Verify CommonJS import from npm
29+
run: |
30+
mkdir verify-cjs
31+
cd verify-cjs
32+
npm init -y
33+
npm install @dfsync/client@${{ steps.pkg.outputs.version }}
34+
node -e "const { createClient } = require('@dfsync/client'); if (typeof createClient !== 'function') throw new Error('Expected createClient to be a function'); console.log('CJS import OK')"
35+
36+
- name: Verify ESM import from npm
37+
run: |
38+
mkdir verify-esm
39+
cd verify-esm
40+
npm init -y
41+
npm pkg set type=module
42+
npm install @dfsync/client@${{ steps.pkg.outputs.version }}
43+
node -e "import('@dfsync/client').then((m) => { if (typeof m.createClient !== 'function') throw new Error('Expected createClient to be a function'); console.log('ESM import OK'); }).catch((err) => { console.error(err); process.exit(1); })"

0 commit comments

Comments
 (0)