@@ -375,126 +375,4 @@ jobs:
375375 echo "Generated packages:"
376376 find packages/binaries -name package.json -exec echo {} \; -exec jq -r '.name + "@" + .version' {} \;
377377 echo ""
378- echo "💾 Cache primed for CI e2e tests"
379-
380- publish-main :
381- name : Publish main socket package
382- needs : publish-packages
383- runs-on : ubuntu-latest
384- permissions :
385- contents : read
386- id-token : write
387-
388- steps :
389- - name : Checkout
390- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
391- with :
392- autocrlf : false
393-
394- - name : Setup Node.js
395- uses : actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
396- with :
397- node-version : 22
398- registry-url : ' https://registry.npmjs.org'
399-
400- - name : Setup pnpm
401- uses : pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
402- with :
403- version : ^10.20.0
404-
405- - name : Install latest npm
406- run : npm install -g npm@latest
407-
408- - name : Install dependencies
409- run : pnpm install --frozen-lockfile
410-
411- - name : Determine version
412- id : version
413- run : |
414- VERSION="${{ inputs.version }}"
415- if [ -z "$VERSION" ]; then
416- # Read base version from socketbin package and extract X.Y.Z using semver
417- PKG_VERSION=$(jq -r '.version' packages/socketbin-cli-linux-x64/package.json)
418- BASE_VERSION=$(node -e "const semver = require('semver'); const v = semver.parse('$PKG_VERSION'); console.log(v ? \`\${v.major}.\${v.minor}.\${v.patch}\` : '0.0.0');")
419- # Auto-generate version in semver format: X.Y.Z-YYYYMMDD.HHmmss
420- VERSION="${BASE_VERSION}-$(date -u +'%Y%m%d.%H%M%S')"
421- echo "Generated version: $VERSION"
422- else
423- # Remove 'v' prefix if present
424- VERSION="${VERSION#v}"
425- echo "Using provided version: $VERSION"
426- fi
427- echo "version=${VERSION}" >> $GITHUB_OUTPUT
428-
429- - name : Update package.json for @socketbin
430- run : |
431- cd src/sea/npm-package
432-
433- # Update version
434- npm version ${{ steps.version.outputs.version }} --no-git-tag-version
435-
436- # Update package.json to use optionalDependencies
437- node -e "
438- const fs = require('fs');
439- const { execSync } = require('child_process');
440- const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
441-
442- // Remove old postinstall script
443- delete pkg.scripts?.postinstall;
444-
445- // Add dispatcher script to bin
446- pkg.bin = { socket: 'bin/socket.js' };
447-
448- // Get latest version from registry for each platform package
449- const platforms = [
450- 'alpine-arm64', 'alpine-x64',
451- 'darwin-arm64', 'darwin-x64',
452- 'linux-arm64', 'linux-x64',
453- 'win32-arm64', 'win32-x64'
454- ];
455-
456- pkg.optionalDependencies = {};
457- for (const platform of platforms) {
458- const pkgName = \`@socketbin/cli-\${platform}\`;
459- try {
460- // Get latest published version from registry
461- const version = execSync(\`npm view \${pkgName} version\`, { encoding: 'utf8' }).trim();
462- pkg.optionalDependencies[pkgName] = version;
463- console.log(\`Using published version for \${pkgName}: \${version}\`);
464- } catch (e) {
465- // Package doesn't exist yet - skip it
466- console.log(\`Package \${pkgName} not found in registry, skipping\`);
467- }
468- }
469-
470- // Update files list
471- pkg.files = ['bin', 'README.md'];
472-
473- fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
474- "
475-
476- # Show the updated package.json
477- cat package.json
478-
479- - name : Validate main package
480- run : |
481- cd src/sea/npm-package
482- # Basic validation
483- test -f package.json || exit 1
484- test -f bin/socket.js || exit 1
485- test -f README.md || exit 1
486- echo "✓ Package structure validated"
487-
488- - name : Publish main package
489- if : ${{ !inputs.dry-run }}
490- working-directory : src/sea/npm-package
491- run : npm publish --provenance --access public --tag latest
492-
493- - name : Dry run summary
494- if : ${{ inputs.dry-run }}
495- run : |
496- echo "🚫 Dry run mode - main package was NOT published"
497- echo ""
498- echo "Would have published:"
499- cd src/sea/npm-package
500- echo "socket@$(jq -r .version package.json)"
378+ echo "💾 Cache primed for CI e2e tests"
0 commit comments