Skip to content

Commit ccd873e

Browse files
committed
ci: add dist-tag support for publishing from non-main branches
When releasing from branches other than main (e.g., feature branches, release candidates), the dist-tag should be set to something other than 'latest' to prevent accidental default installs. Changes: - Add dist-tag input to workflow (default: 'latest') - Create publish:ci script that reads DIST_TAG env var - Update to socket-registry provenance workflow with dist-tag support - Pass dist-tag to reusable workflow Usage: - Publish from main: dist-tag='latest' (default) - Publish from branch: dist-tag='next', 'beta', 'canary', etc. This ensures pre-release versions don't become the default npm install.
1 parent dc5fd56 commit ccd873e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/provenance.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: 📦 Publish
33
on:
44
workflow_dispatch:
55
inputs:
6+
dist-tag:
7+
description: 'npm dist-tag (latest, next, beta, canary, etc.)'
8+
required: false
9+
default: 'latest'
10+
type: string
611
debug:
712
description: 'Enable debug output'
813
required: false
@@ -18,9 +23,11 @@ permissions:
1823

1924
jobs:
2025
publish:
21-
uses: SocketDev/socket-registry/.github/workflows/provenance.yml@1a96ced97aaa85d61543351b90d6f463b983c46c # main
26+
uses: SocketDev/socket-registry/.github/workflows/provenance.yml@c722588dc8547ea3f1094f7930ce3ca3b725ffd8 # main
2227
with:
2328
debug: ${{ inputs.debug }}
29+
dist-tag: ${{ inputs.dist-tag }}
2430
package-name: '@socketsecurity/sdk'
31+
publish-script: 'publish:ci'
2532
setup-script: 'pnpm run build'
2633
use-trusted-publishing: true

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"prepare": "husky",
4848
"prepublishOnly": "echo 'ERROR: Use GitHub Actions workflow for publishing' && exit 1",
4949
"publish": "node scripts/publish.mjs",
50+
"publish:ci": "node scripts/publish.mjs --skip-checks --skip-build --tag ${DIST_TAG:-latest}",
5051
"claude": "node scripts/claude.mjs",
5152
"test": "node scripts/test.mjs",
5253
"type": "tsgo --noEmit -p .config/tsconfig.check.json",

0 commit comments

Comments
 (0)