@@ -174,42 +174,81 @@ jobs:
174174 pattern : bindings-*
175175 merge-multiple : true
176176
177- - name : Move artifacts
177+ - name : Process artifacts and prepare packages
178178 run : |
179179 echo "Debug: Showing all downloaded artifacts:"
180180 find . -type f -name "*.node" -ls
181181
182- echo "\nMoving only cel-typescript binaries to root:"
183- find . -type f -name "cel-typescript.*.node" -exec mv {} . \;
184-
185- echo "\nBinaries in root directory:"
186- ls -la cel-typescript.*.node
187-
188- # Count our binaries
189- node_count=$(ls -1 cel-typescript.*.node 2>/dev/null | wc -l)
182+ echo "\nMoving binaries to their respective package directories:"
183+
184+ # Copy binaries to their package directories
185+ find . -name "cel-typescript.darwin-arm64.node" -exec cp {} libs/darwin-arm64/ \;
186+ find . -name "cel-typescript.darwin-x64.node" -exec cp {} libs/darwin-x64/ \;
187+ find . -name "cel-typescript.linux-x64-gnu.node" -exec cp {} libs/linux-x64-gnu/ \;
188+ find . -name "cel-typescript.linux-arm64-gnu.node" -exec cp {} libs/linux-arm64-gnu/ \;
189+ find . -name "cel-typescript.win32-x64-msvc.node" -exec cp {} libs/win32-x64-msvc/ \;
190+
191+ # Count our binaries to ensure we have all of them
192+ node_count=$(find libs -name "cel-typescript.*.node" | wc -l)
190193 expected_count=5 # We target 5 platforms
191-
192- echo "\nFound $node_count cel-typescript binaries (expected $expected_count)"
194+
195+ echo "\nFound $node_count cel-typescript binaries in package directories (expected $expected_count)"
193196
194197 if [ "$node_count" -ne "$expected_count" ]; then
195198 echo "Error: Expected $expected_count binaries but found $node_count"
196199 exit 1
197200 fi
201+
202+ # Set version for all packages based on tag
203+ if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
204+ VERSION=${GITHUB_REF#refs/tags/v}
205+ echo "Setting version to $VERSION for all packages"
206+
207+ for pkg in libs/darwin-arm64 libs/darwin-x64 libs/linux-x64-gnu libs/linux-arm64-gnu libs/win32-x64-msvc; do
208+ jq ".version = \"$VERSION\"" $pkg/package.json > tmp.json && mv tmp.json $pkg/package.json
209+ done
210+
211+ # Set the core package version too
212+ jq ".version = \"$VERSION\"" libs/core/package.json > tmp.json && mv tmp.json libs/core/package.json
213+ else
214+ echo "Not a tag push, skipping version update"
215+ fi
198216
199217 - name : Build TypeScript
200218 run : npm run build:ts
201219
202- - name : Verify package contents
220+ - name : Publish Core Package (Dry Run)
221+ if : github.event_name == 'pull_request'
203222 run : |
204- echo "Package contents:"
223+ cd libs/core
205224 npm pack --dry-run
206225
207- - name : Publish
226+ - name : Publish Platform Packages (Dry Run)
227+ if : github.event_name == 'pull_request'
228+ run : |
229+ for pkg in darwin-arm64 darwin-x64 linux-x64-gnu linux-arm64-gnu win32-x64-msvc; do
230+ echo "\n==== Dry run publishing $pkg package ===="
231+ cd libs/$pkg
232+ npm pack --dry-run
233+ cd ../..
234+ done
235+
236+ - name : Publish Core Package
208237 if : startsWith(github.ref, 'refs/tags/v')
209- run : npm publish --provenance --access public
238+ run : |
239+ cd libs/core
240+ npm publish --provenance --access public
210241 env :
211242 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
212243
213- - name : Publish (Dry Run)
214- if : github.event_name == 'pull_request'
215- run : npm publish --dry-run
244+ - name : Publish Platform Packages
245+ if : startsWith(github.ref, 'refs/tags/v')
246+ run : |
247+ for pkg in darwin-arm64 darwin-x64 linux-x64-gnu linux-arm64-gnu win32-x64-msvc; do
248+ echo "\n==== Publishing $pkg package ===="
249+ cd libs/$pkg
250+ npm publish --provenance --access public
251+ cd ../..
252+ done
253+ env :
254+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments