From 0e216bc33a68f93b90349872559bfb2540d94cdd Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 20 Jan 2021 14:14:42 -0800 Subject: [PATCH] cherry-pick(release-1.8): update publish script to work for @next (#5075) Cherry-pick 0d0a6e8f82561ccdb5c81c2038bca813776bbfb9 Co-authored-by: Dmitry Gozman --- .github/workflows/publish_canary_npm.yml | 2 +- utils/publish_all_packages.sh | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish_canary_npm.yml b/.github/workflows/publish_canary_npm.yml index 2529d42a6b406..a9d67c3789c43 100644 --- a/.github/workflows/publish_canary_npm.yml +++ b/.github/workflows/publish_canary_npm.yml @@ -20,7 +20,7 @@ jobs: - uses: microsoft/playwright-github-action@v1 - run: npm ci - run: npm run build - - run: node utils/build/update_canary_version.js + # publish_all_packages.sh updates the version automatically - run: utils/publish_all_packages.sh --tip-of-tree env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/utils/publish_all_packages.sh b/utils/publish_all_packages.sh index 46c7310afb0a5..ef1567024f446 100755 --- a/utils/publish_all_packages.sh +++ b/utils/publish_all_packages.sh @@ -41,14 +41,18 @@ fi cd .. -NPM_PUBLISH_TAG="next" -VERSION=$(node -e 'console.log(require("./package.json").version)') - if [[ -n $(git status -s) ]]; then echo "ERROR: git status is dirty; some uncommitted changes or untracked files" exit 1 fi +NPM_PUBLISH_TAG="next" + +if [[ $1 == "--tip-of-tree" ]]; then + node utils/build/update_canary_version.js +fi +VERSION=$(node -e 'console.log(require("./package.json").version)') + if [[ $1 == "--release" ]]; then # Ensure package version does not contain dash. if [[ "${VERSION}" == *-* ]]; then @@ -76,6 +80,8 @@ else exit 1 fi +echo "==================== Building version ${VERSION} ================" + PLAYWRIGHT_TGZ="$PWD/playwright.tgz" PLAYWRIGHT_CORE_TGZ="$PWD/playwright-core.tgz" PLAYWRIGHT_WEBKIT_TGZ="$PWD/playwright-webkit.tgz" @@ -87,6 +93,8 @@ node ./packages/build_package.js playwright-webkit "${PLAYWRIGHT_WEBKIT_TGZ}" node ./packages/build_package.js playwright-firefox "${PLAYWRIGHT_FIREFOX_TGZ}" node ./packages/build_package.js playwright-chromium "${PLAYWRIGHT_CHROMIUM_TGZ}" +echo "==================== Publishing version ${VERSION} ================" + npm publish ${PLAYWRIGHT_TGZ} --tag="${NPM_PUBLISH_TAG}" npm publish ${PLAYWRIGHT_CORE_TGZ} --tag="${NPM_PUBLISH_TAG}" npm publish ${PLAYWRIGHT_WEBKIT_TGZ} --tag="${NPM_PUBLISH_TAG}"