chore: support release candidate publishing (#10360)

Fixes #10334
This commit is contained in:
Andrey Lushnikov 2021-11-16 14:28:34 -08:00 committed by GitHub
parent 82002b2803
commit 6904d6c7e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View file

@ -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 }}

View file

@ -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"