From 6904d6c7e6f090fb2bd3307c2cdd516a7cf83f9b Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 16 Nov 2021 14:28:34 -0800 Subject: [PATCH] chore: support release candidate publishing (#10360) Fixes #10334 --- .github/workflows/publish_release.yml | 7 ++++++- utils/publish_all_packages.sh | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 3feab744f8..065fc6f2f4 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -19,7 +19,12 @@ jobs: - run: npm ci - run: npm run build - run: npx playwright install-deps + - run: utils/publish_all_packages.sh --release-candidate + if: "github.event.release.prerelease" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: utils/publish_all_packages.sh --release + if: "!github.event.release.prerelease" env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -74,5 +79,5 @@ jobs: - run: npm i -g npm@7 - name: Deploy Stable run: bash utils/build/deploy-trace-viewer.sh --stable - env: + env: GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }} diff --git a/utils/publish_all_packages.sh b/utils/publish_all_packages.sh index 54b6e2e4ba..459df1c847 100755 --- a/utils/publish_all_packages.sh +++ b/utils/publish_all_packages.sh @@ -46,7 +46,7 @@ NPM_PUBLISH_TAG="next" VERSION=$(node -e 'console.log(require("./package.json").version)') -if [[ $1 == "--release" ]]; then +if [[ "$1" == "--release" ]]; then if [[ -n $(git status -s) ]]; then echo "ERROR: git status is dirty; some uncommitted changes or untracked files" exit 1 @@ -57,7 +57,18 @@ if [[ $1 == "--release" ]]; then exit 1 fi NPM_PUBLISH_TAG="latest" -elif [[ $1 == "--next" ]]; then +elif [[ "$1" == "--release-candidate" ]]; then + if [[ -n $(git status -s) ]]; then + echo "ERROR: git status is dirty; some uncommitted changes or untracked files" + exit 1 + fi + # Ensure package version is properly formatted. + if [[ "${VERSION}" != *-rc* ]]; then + echo "ERROR: release candidate version must have a dash" + exit 1 + fi + NPM_PUBLISH_TAG="rc" +elif [[ "$1" == "--next" ]]; then # Ensure package version contains dash. if [[ "${VERSION}" != *-* ]]; then echo "ERROR: cannot publish release version with --next flag" @@ -65,7 +76,7 @@ elif [[ $1 == "--next" ]]; then fi NPM_PUBLISH_TAG="next" -elif [[ $1 == "--beta" ]]; then +elif [[ "$1" == "--beta" ]]; then # Ensure package version contains dash. if [[ "${VERSION}" != *-* ]]; then echo "ERROR: cannot publish release version with --beta flag"