@@ -22,25 +22,25 @@ jobs:
2222 - name : Checkout
2323 uses : actions/checkout@v6
2424
25- - name : Setup Node.js
26- uses : actions /setup-node@v6
25+ - name : Setup Bun
26+ uses : oven-sh /setup-bun@v1
2727 with :
28- node -version : " 18 "
28+ bun -version : latest
2929
3030 - name : Install dependencies
31- run : npm ci
31+ run : bun install --frozen-lockfile
3232
3333 - name : Run linting
34- run : npm run lint
34+ run : bun run lint
3535
3636 - name : Run type checking
37- run : npm run typecheck
37+ run : bun run typecheck
3838
3939 - name : Run tests
40- run : npm run test
40+ run : bun run test
4141
4242 - name : Build package
43- run : npm run build
43+ run : bun run build
4444
4545 publish-npm :
4646 needs : test
@@ -50,36 +50,35 @@ jobs:
5050 - name : Checkout
5151 uses : actions/checkout@v6
5252
53- - name : Setup Node.js
54- uses : actions /setup-node@v6
53+ - name : Setup Bun
54+ uses : oven-sh /setup-bun@v1
5555 with :
56- node-version : " 18"
57- registry-url : " https://registry.npmjs.org"
56+ bun-version : latest
5857
5958 - name : Install dependencies
60- run : npm ci
59+ run : bun install --frozen-lockfile
6160
6261 - name : Build package
63- run : npm run build
62+ run : bun run build
6463
6564 - name : Publish to NPM (with fallback to scoped name)
6665 run : |
6766 # Backup original package.json
6867 cp package.json package.json.backup
6968
7069 # Try publishing with original name first
71- ORIGINAL_NAME=$(node -p " require('./package.json').name")
70+ ORIGINAL_NAME=$(bun -e "console.log( require('./package.json').name) ")
7271 echo "📦 Attempting to publish with original name: $ORIGINAL_NAME"
7372
74- if npm publish; then
73+ if bun publish; then
7574 echo "✅ Successfully published with original name: $ORIGINAL_NAME"
7675 else
7776 echo "❌ Failed to publish with original name, trying with scoped name..."
7877 # Restore backup
7978 mv package.json.backup package.json
8079
8180 # Create scoped version using GitHub username
82- node -e "
81+ bun -e "
8382 const pkg = require('./package.json');
8483 const owner = process.env.GITHUB_REPOSITORY.split('/')[0];
8584 const originalName = pkg.name.replace(/^@[^/]+\//, ''); // Remove existing scope if any
@@ -92,12 +91,12 @@ jobs:
9291 require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));
9392 "
9493
95- SCOPED_NAME=$(node -p " require('./package.json').name")
94+ SCOPED_NAME=$(bun -e "console.log( require('./package.json').name) ")
9695 echo "🚀 Publishing scoped package: $SCOPED_NAME"
9796
98- if npm publish; then
97+ if bun publish; then
9998 echo "✅ Successfully published with scoped name: $SCOPED_NAME"
100- echo "💡 Users can install with: npm install $SCOPED_NAME"
99+ echo "💡 Users can install with: bun add $SCOPED_NAME"
101100 else
102101 echo "❌ Failed to publish even with scoped name: $SCOPED_NAME"
103102 echo "🔍 Please check NPM_TOKEN permissions and package configuration"
@@ -124,23 +123,22 @@ jobs:
124123 - name : Checkout
125124 uses : actions/checkout@v6
126125
127- - name : Setup Node.js
128- uses : actions /setup-node@v6
126+ - name : Setup Bun
127+ uses : oven-sh /setup-bun@v1
129128 with :
130- node-version : " 18"
131- registry-url : " https://npm.pkg.github.com"
129+ bun-version : latest
132130
133131 - name : Install dependencies
134- run : npm ci
132+ run : bun install --frozen-lockfile
135133
136134 - name : Build package
137- run : npm run build
135+ run : bun run build
138136
139137 - name : Configure package for GitHub
140138 run : |
141139 # Create a temporary package.json for GitHub publishing
142140 cp package.json package.json.backup
143- node -e "
141+ bun -e "
144142 const pkg = require('./package.json');
145143 const owner = process.env.GITHUB_REPOSITORY.split('/')[0];
146144 const repoName = process.env.GITHUB_REPOSITORY.split('/')[1];
@@ -158,7 +156,7 @@ jobs:
158156 "
159157
160158 - name : Publish to GitHub Packages
161- run : npm publish
159+ run : bun publish
162160 env :
163161 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
164162
0 commit comments