From 5fc8ec610d52b0c35498bc2e8ab2c2630ada8132 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 18 Jan 2023 06:00:33 -0800 Subject: [PATCH] Publish to the correct channels instead of always latest (#6963) Signed-off-by: Sebastian Malton Signed-off-by: Sebastian Malton --- .github/workflows/release.yml | 1 + Makefile | 7 ++----- scripts/publish-extensions-npm.sh | 7 +++++++ scripts/publish-library-npm.sh | 7 +++++++ 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100755 scripts/publish-extensions-npm.sh create mode 100755 scripts/publish-library-npm.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4fc05cd5d3b5..911a10372806 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,7 @@ jobs: commit: master tag: ${{ steps.tagger.outputs.tagname }} body: ${{ github.event.pull_request.body }} + prerelease: ${{ endsWith(steps.tagger.outputs.tagname, '-alpha') || endsWith(steps.tagger.outputs.tagname, '-beta') }} publish-npm: uses: ./.github/workflows/publish-release-npm.yml needs: release diff --git a/Makefile b/Makefile index b6b14141ba94..b7c0cd3b8dc3 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ CMD_ARGS = $(filter-out $@,$(MAKECMDGOALS)) %: @: -NPM_RELEASE_TAG ?= latest ELECTRON_BUILDER_EXTRA_ARGS ?= ifeq ($(OS),Windows_NT) @@ -84,13 +83,11 @@ build-extension-types: node_modules packages/extensions/dist .PHONY: publish-extensions-npm publish-extensions-npm: node_modules build-extensions-npm - ./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" - cd packages/extensions && npm publish --access=public --tag=$(NPM_RELEASE_TAG) && git restore package.json + ./scripts/publish-extensions-npm.sh .PHONY: publish-library-npm publish-library-npm: node_modules build-library-npm - ./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" - npm publish --access=public --tag=$(NPM_RELEASE_TAG) + ./scripts/publish-library-npm.sh .PHONY: build-docs build-docs: diff --git a/scripts/publish-extensions-npm.sh b/scripts/publish-extensions-npm.sh new file mode 100755 index 000000000000..a715bc73d4d4 --- /dev/null +++ b/scripts/publish-extensions-npm.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" + +NPM_RELEASE_TAG=$(cat package.json | jq .version --raw-output | rg '.*-(?P\w+).*' -r '$channel' | cat) + +cd packages/extensions && npm publish --access=public --tag=${NPM_RELEASE_TAG:-latest} && git restore package.json diff --git a/scripts/publish-library-npm.sh b/scripts/publish-library-npm.sh new file mode 100755 index 000000000000..6fdd16e8a83d --- /dev/null +++ b/scripts/publish-library-npm.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" + +NPM_RELEASE_TAG=$(cat package.json | jq .version --raw-output | rg '.*-(?P\w+).*' -r '$channel' | cat) + +npm publish --access=public --tag=${NPM_RELEASE_TAG:-latest}