File tree Expand file tree Collapse file tree 5 files changed +74
-5
lines changed Expand file tree Collapse file tree 5 files changed +74
-5
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,14 @@ name: Publish Package
22on :
33 workflow_dispatch :
44 inputs :
5+ package_registry :
6+ description : ' Publish to'
7+ required : true
8+ default : ' npm'
9+ type : choice
10+ options :
11+ - npm
12+ - jsr
513 workspace_path :
614 description : ' The workspace to publish'
715 required : true
3947 id-token : write
4048 contents : read
4149 steps :
42- - uses : actions/checkout@v3
43- - uses : actions/setup-node@v3
50+ - uses : actions/checkout@v4
51+ - uses : actions/setup-node@v4
4452 with :
4553 node-version : 16.x
4654 registry-url : ' https://registry.npmjs.org'
8189 yarn config set npmScopes.launchdarkly.npmRegistryServer "https://registry.npmjs.org"
8290 yarn config set npmScopes.launchdarkly.npmAlwaysAuth true
8391 yarn config set npmScopes.launchdarkly.npmAuthToken $NODE_AUTH_TOKEN
84- - id : publish
85- name : Publish Package
92+ - id : publish-jsr
93+ name : Publish Package to jsr
94+ if : ${{ inputs.package_registry == 'jsr' }}
95+ uses : ./actions/publish-jsr
96+ with :
97+ workspace_name : ${{ env.WORKSPACE_NAME }}
98+ workspace_path : ${{ inputs.workspace_path }}
99+ dry_run : ${{ inputs.dry_run }}
100+ - id : publish-npm
101+ name : Publish Package to npm
102+ if : ${{ inputs.package_registry == 'npm' }}
86103 uses : ./actions/publish
87104 with :
88105 workspace_name : ${{ env.WORKSPACE_NAME }}
Original file line number Diff line number Diff line change 3131 yarn config set npmScopes.launchdarkly.npmRegistryServer "https://registry.npmjs.org"
3232 yarn config set npmScopes.launchdarkly.npmAlwaysAuth true
3333 yarn config set npmScopes.launchdarkly.npmAuthToken $NODE_AUTH_TOKEN
34+ - uses : ./actions/publish-jsr
35+ with :
36+ workspace_name : ${{ env.WORKSPACE_NAME }}
37+ workspace_path : ${{ inputs.workspace_path }}
38+ dry_run : false
3439 - uses : ./actions/publish
3540 with :
3641 workspace_name : ${{ env.WORKSPACE_NAME }}
Original file line number Diff line number Diff line change 1+ name : Publish to jsr
2+ description : Publish a package to jsr from the workspace.
3+ inputs :
4+ workspace_name :
5+ description : ' The workspace to publish'
6+ required : true
7+ workspace_path :
8+ description : ' Path to the workspace (for jsr publish)'
9+ required : true
10+ dry_run :
11+ description : ' Is this a dry run. If so no package will be published.'
12+ required : true
13+
14+ runs :
15+ using : composite
16+ steps :
17+ - name : Publish jsr
18+ shell : bash
19+ run : |
20+ echo "Publishing jsr: $WORKSPACE"
21+ ./scripts/publish-jsr.sh
22+ env :
23+ WORKSPACE : ${{ inputs.workspace_name }}
24+ WORKSPACE_PATH : ${{ inputs.workspace_path }}
25+ LD_RELEASE_IS_DRYRUN : ${{ inputs.dry_run }}
Original file line number Diff line number Diff line change 55 "packages/shared/sdk-server" : {},
66 "packages/shared/sdk-server-edge" : {},
77 "packages/shared/akamai-edgeworker-sdk" : {},
8- "packages/sdk/cloudflare" : {},
8+ "packages/sdk/cloudflare" : {
9+ "extra-files" : [
10+ {
11+ "type" : " json" ,
12+ "path" : " jsr.json" ,
13+ "jsonpath" : " $.version"
14+ }
15+ ]
16+ },
917 "packages/sdk/react-native" : {},
1018 "packages/sdk/server-node" : {},
1119 "packages/sdk/vercel" : {
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ if [ -f " ./$WORKSPACE_PATH /jsr.json" ]; then
4+ yarn workspace $WORKSPACE pack
5+ cd $WORKSPACE_PATH
6+
7+ if $LD_RELEASE_IS_DRYRUN ; then
8+ echo " Doing a dry run of jsr publishing."
9+ npx jsr publish --dry-run || { echo " jsr publish failed" >&2 ; exit 1; }
10+ elif [ -f " ./$WORKSPACE_PATH /jsr.json" ]; then
11+ echo " Publishing to jsr."
12+ npx jsr publish || { echo " jsr publish failed" >&2 ; exit 1; }
13+ fi
14+ fi
You can’t perform that action at this time.
0 commit comments