From 4a176441e68bf78343f13f077b1ccedbce8478a9 Mon Sep 17 00:00:00 2001 From: Rouel Joseph Soberano Date: Wed, 22 Nov 2023 12:13:49 -0800 Subject: [PATCH 1/7] build: modfying publish action to use npm cli to include provenance in npm publish --- .github/workflows/manual-publish.yml | 1 + actions/full-release/action.yml | 1 + actions/publish/action.yml | 4 ++++ scripts/publish.sh | 6 +++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml index aa7f508c6..05c104625 100644 --- a/.github/workflows/manual-publish.yml +++ b/.github/workflows/manual-publish.yml @@ -80,5 +80,6 @@ jobs: uses: ./actions/publish with: workspace_name: ${{ env.WORKSPACE_NAME }} + workspace_path: ${{ inputs.workspace_path }} prerelease: ${{ inputs.prerelease }} dry_run: ${{ inputs.dry_run }} diff --git a/actions/full-release/action.yml b/actions/full-release/action.yml index b295d2448..17ff7e8f8 100644 --- a/actions/full-release/action.yml +++ b/actions/full-release/action.yml @@ -34,6 +34,7 @@ runs: - uses: ./actions/publish with: workspace_name: ${{ env.WORKSPACE_NAME }} + workspace_path: ${{ inputs.workspace_path }} prerelease: false dry_run: false - uses: ./actions/publish-docs diff --git a/actions/publish/action.yml b/actions/publish/action.yml index 7dc17901e..9b850e771 100644 --- a/actions/publish/action.yml +++ b/actions/publish/action.yml @@ -4,6 +4,9 @@ inputs: workspace_name: description: 'The workspace to publish' required: true + workspace_path: + description: 'Path to the workspace (for npm publish)' + required: true prerelease: description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.' required: true @@ -21,5 +24,6 @@ runs: ./scripts/publish.sh env: WORKSPACE: ${{ inputs.workspace_name }} + WORKSPACE_PATH: ${{ inputs.workspace_path }} LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }} LD_RELEASE_IS_DRYRUN: ${{ inputs.dry_run }} diff --git a/scripts/publish.sh b/scripts/publish.sh index 8619a6a12..7f326fd18 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash +yarn workspace $WORKSPACE pack if $LD_RELEASE_IS_DRYRUN ; then # Dry run just pack the workspace. echo "Doing a dry run of publishing." - yarn workspace $WORKSPACE pack else if $LD_RELEASE_IS_PRERELEASE ; then echo "Publishing with prerelease tag." - yarn workspace $WORKSPACE npm publish --tag prerelease || { echo "npm publish failed" >&2; exit 1; } + npm publish --tag prerelease --provenance --access public "./$WORKSPACE_PATH/package.tgz" || { echo "npm publish failed" >&2; exit 1; } else - yarn workspace $WORKSPACE npm publish || { echo "npm publish failed" >&2; exit 1; } + npm publish --provenance --access public "./$WORKSPACE_PATH/package.tgz" || { echo "npm publish failed" >&2; exit 1; } fi fi From a77957a9a606337e6fd5f7e889a43a52ec785f2e Mon Sep 17 00:00:00 2001 From: Rouel Joseph Soberano Date: Wed, 6 Dec 2023 14:07:39 -0800 Subject: [PATCH 2/7] Updating version of npm to support provenance option --- .github/workflows/manual-publish.yml | 3 +++ .github/workflows/release-please.yml | 33 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml index 05c104625..572cb9006 100644 --- a/.github/workflows/manual-publish.yml +++ b/.github/workflows/manual-publish.yml @@ -41,6 +41,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - name: 'Setup Redis' if: ${{ inputs.workspace_path == 'packages/store/node-server-sdk-redis' }} run: | diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 494977f58..7492228aa 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -40,6 +40,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/shared/common uses: ./actions/full-release @@ -60,6 +63,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/shared/sdk-server uses: ./actions/full-release @@ -80,6 +86,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/shared/sdk-server-edge uses: ./actions/full-release @@ -100,6 +109,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/shared/akamai-edgeworker-sdk uses: ./actions/full-release @@ -120,6 +132,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/sdk/cloudflare uses: ./actions/full-release @@ -140,6 +155,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/sdk/server-node uses: ./actions/full-release @@ -160,6 +178,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/sdk/vercel uses: ./actions/full-release @@ -180,6 +201,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/sdk/akamai-base uses: ./actions/full-release @@ -200,6 +224,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - id: release-common name: Full release of packages/sdk/akamai-edgekv uses: ./actions/full-release @@ -220,6 +247,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - run: | sudo apt-get update sudo apt-get install redis-server @@ -244,6 +274,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm - run: | sudo docker run -d -p 8000:8000 amazon/dynamodb-local - id: release-common From 9caf0095793df8744bc704731f7bf05a271ac9af Mon Sep 17 00:00:00 2001 From: Rouel Joseph Soberano Date: Wed, 6 Dec 2023 14:59:20 -0800 Subject: [PATCH 3/7] Breaking out npm install into action --- .github/workflows/manual-publish.yml | 4 +-- .github/workflows/release-please.yml | 44 +++++++-------------------- actions/install-latest-npm/action.yml | 8 +++++ 3 files changed, 20 insertions(+), 36 deletions(-) create mode 100644 actions/install-latest-npm/action.yml diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml index 572cb9006..594ea7b2b 100644 --- a/.github/workflows/manual-publish.yml +++ b/.github/workflows/manual-publish.yml @@ -41,9 +41,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - name: 'Setup Redis' if: ${{ inputs.workspace_path == 'packages/store/node-server-sdk-redis' }} run: | diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 7492228aa..f1bdad16f 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -40,9 +40,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/shared/common uses: ./actions/full-release @@ -63,9 +61,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/shared/sdk-server uses: ./actions/full-release @@ -86,9 +82,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/shared/sdk-server-edge uses: ./actions/full-release @@ -109,9 +103,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/shared/akamai-edgeworker-sdk uses: ./actions/full-release @@ -132,9 +124,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/sdk/cloudflare uses: ./actions/full-release @@ -155,9 +145,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/sdk/server-node uses: ./actions/full-release @@ -178,9 +166,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/sdk/vercel uses: ./actions/full-release @@ -201,9 +187,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/sdk/akamai-base uses: ./actions/full-release @@ -224,9 +208,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - id: release-common name: Full release of packages/sdk/akamai-edgekv uses: ./actions/full-release @@ -247,9 +229,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - run: | sudo apt-get update sudo apt-get install redis-server @@ -274,9 +254,7 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - name: 'Install latest npm to support provenance publishing' - run: | - npm install -g npm + - uses: ./actions/install-latest-npm - run: | sudo docker run -d -p 8000:8000 amazon/dynamodb-local - id: release-common diff --git a/actions/install-latest-npm/action.yml b/actions/install-latest-npm/action.yml new file mode 100644 index 000000000..13f789906 --- /dev/null +++ b/actions/install-latest-npm/action.yml @@ -0,0 +1,8 @@ +name: Install latest npm +description: Install the latest version of the npm CLI utility +runs: + using: composite + steps: + - name: 'Install latest npm to support provenance publishing' + run: | + npm install -g npm \ No newline at end of file From 8882e6f08f802b6e7d0acf7b2b0130c475b28376 Mon Sep 17 00:00:00 2001 From: Rouel Joseph Soberano Date: Wed, 6 Dec 2023 16:25:09 -0800 Subject: [PATCH 4/7] Fixing npm action --- actions/install-latest-npm/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actions/install-latest-npm/action.yml b/actions/install-latest-npm/action.yml index 13f789906..d89f400b8 100644 --- a/actions/install-latest-npm/action.yml +++ b/actions/install-latest-npm/action.yml @@ -4,5 +4,6 @@ runs: using: composite steps: - name: 'Install latest npm to support provenance publishing' + shell: bash run: | - npm install -g npm \ No newline at end of file + npm install -g npm From 7e737aaafa594716d5edd75622c2784e968e40c7 Mon Sep 17 00:00:00 2001 From: Rouel Joseph Soberano Date: Thu, 7 Dec 2023 14:02:23 -0800 Subject: [PATCH 5/7] Bumping node-server-sdk-dynamodb prerelease version --- packages/store/node-server-sdk-dynamodb/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/store/node-server-sdk-dynamodb/package.json b/packages/store/node-server-sdk-dynamodb/package.json index 5185bf391..d064c5ab4 100644 --- a/packages/store/node-server-sdk-dynamodb/package.json +++ b/packages/store/node-server-sdk-dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/node-server-sdk-dynamodb", - "version": "6.0.4", + "version": "6.0.4-alpha.0", "description": "DynamoDB-backed feature store for the LaunchDarkly Server-Side SDK for Node.js", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/store/node-server-sdk-dynamodb", "repository": { From 70d562976022312864f7645ad37f4a5550e6451d Mon Sep 17 00:00:00 2001 From: Rouel Joseph Soberano Date: Thu, 7 Dec 2023 14:15:24 -0800 Subject: [PATCH 6/7] build: allowing specifying of npm version to install --- .github/workflows/manual-publish.yml | 4 ++- .github/workflows/release-please.yml | 44 +++++++++++++++++++------- actions/install-latest-npm/action.yml | 9 ------ actions/install-npm-version/action.yml | 16 ++++++++++ 4 files changed, 52 insertions(+), 21 deletions(-) delete mode 100644 actions/install-latest-npm/action.yml create mode 100644 actions/install-npm-version/action.yml diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml index 594ea7b2b..213ffb973 100644 --- a/.github/workflows/manual-publish.yml +++ b/.github/workflows/manual-publish.yml @@ -41,7 +41,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - name: 'Setup Redis' if: ${{ inputs.workspace_path == 'packages/store/node-server-sdk-redis' }} run: | diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index f1bdad16f..b12b22680 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -40,7 +40,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/shared/common uses: ./actions/full-release @@ -61,7 +63,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/shared/sdk-server uses: ./actions/full-release @@ -82,7 +86,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/shared/sdk-server-edge uses: ./actions/full-release @@ -103,7 +109,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/shared/akamai-edgeworker-sdk uses: ./actions/full-release @@ -124,7 +132,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/sdk/cloudflare uses: ./actions/full-release @@ -145,7 +155,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/sdk/server-node uses: ./actions/full-release @@ -166,7 +178,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/sdk/vercel uses: ./actions/full-release @@ -187,7 +201,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/sdk/akamai-base uses: ./actions/full-release @@ -208,7 +224,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - id: release-common name: Full release of packages/sdk/akamai-edgekv uses: ./actions/full-release @@ -229,7 +247,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - run: | sudo apt-get update sudo apt-get install redis-server @@ -254,7 +274,9 @@ jobs: with: node-version: 16.x registry-url: 'https://registry.npmjs.org' - - uses: ./actions/install-latest-npm + - uses: ./actions/install-npm-version + with: + npm_version: 9.5.0 - run: | sudo docker run -d -p 8000:8000 amazon/dynamodb-local - id: release-common diff --git a/actions/install-latest-npm/action.yml b/actions/install-latest-npm/action.yml deleted file mode 100644 index d89f400b8..000000000 --- a/actions/install-latest-npm/action.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: Install latest npm -description: Install the latest version of the npm CLI utility -runs: - using: composite - steps: - - name: 'Install latest npm to support provenance publishing' - shell: bash - run: | - npm install -g npm diff --git a/actions/install-npm-version/action.yml b/actions/install-npm-version/action.yml new file mode 100644 index 000000000..8a5dd452d --- /dev/null +++ b/actions/install-npm-version/action.yml @@ -0,0 +1,16 @@ +name: Install npm version +# Used to specify a version of npm that supports --provenance (for node installs < 18.X) +description: Install the latest version of the npm CLI utility. +inputs: + npm_version: + description: 'The version of npm to install' + required: false + default: latest + +runs: + using: composite + steps: + - name: 'Install specified npm version' + shell: bash + run: | + npm install -g npm@${{ inputs.npm_version }} From a8e5337f7ed7f9a6ec8cbcd6b62cdd2f6ac9412e Mon Sep 17 00:00:00 2001 From: Rouel Joseph Soberano Date: Thu, 7 Dec 2023 14:19:29 -0800 Subject: [PATCH 7/7] build: undoing version bump after testing --- packages/store/node-server-sdk-dynamodb/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/store/node-server-sdk-dynamodb/package.json b/packages/store/node-server-sdk-dynamodb/package.json index d064c5ab4..5185bf391 100644 --- a/packages/store/node-server-sdk-dynamodb/package.json +++ b/packages/store/node-server-sdk-dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/node-server-sdk-dynamodb", - "version": "6.0.4-alpha.0", + "version": "6.0.4", "description": "DynamoDB-backed feature store for the LaunchDarkly Server-Side SDK for Node.js", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/store/node-server-sdk-dynamodb", "repository": {