diff --git a/.github/workflows/publish_canary.yml b/.github/workflows/publish_canary.yml index c127951888..3b905a55a4 100644 --- a/.github/workflows/publish_canary.yml +++ b/.github/workflows/publish_canary.yml @@ -26,25 +26,34 @@ jobs: - name: "@next: publish with commit timestamp (triggered manually)" if: contains(github.ref, 'master') && github.event_name == 'workflow_dispatch' run: | - node utils/build/update_canary_version.js --commit-timestamp - utils/publish_all_packages.sh --next + node utils/build/update_canary_version.js --alpha --commit-timestamp + utils/publish_all_packages.sh --alpha env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: "@next: publish with today's date (triggered automatically)" if: contains(github.ref, 'master') && github.event_name != 'workflow_dispatch' run: | - node utils/build/update_canary_version.js --today-date - utils/publish_all_packages.sh --next + node utils/build/update_canary_version.js --alpha --today-date + utils/publish_all_packages.sh --alpha env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: "@beta: publish with commit timestamp (triggered automatically)" if: contains(github.ref, 'release') && github.event_name != 'workflow_dispatch' run: | - node utils/build/update_canary_version.js --commit-timestamp + node utils/build/update_canary_version.js --beta --commit-timestamp utils/publish_all_packages.sh --beta env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: | + - name: build & publish driver + env: + AZ_UPLOAD_FOLDER: driver/next + AZ_ACCOUNT_KEY: ${{ secrets.AZ_ACCOUNT_KEY }} + AZ_ACCOUNT_NAME: ${{ secrets.AZ_ACCOUNT_NAME }} + run: | + utils/build/build-playwright-driver.sh + utils/build/upload-playwright-driver.sh + - name: trigger docker build + run: | VERSION=$(node -e 'console.log(require("./package.json").version)') if [[ "${VERSION}" != *-* ]]; then echo "ERROR: canary version must have dash inside, received '${VERSION}' instead" diff --git a/.github/workflows/publish_canary_driver.yml b/.github/workflows/publish_canary_driver.yml deleted file mode 100644 index c0307d3bae..0000000000 --- a/.github/workflows/publish_canary_driver.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: "devrelease:driver" - -on: - workflow_dispatch: - schedule: - - cron: "10 0 * * *" - push: - branches: - - release-* - -jobs: - publish-canary-driver: - name: "publish playwright driver to CDN" - runs-on: ubuntu-20.04 - if: github.repository == 'microsoft/playwright' - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 12 - registry-url: 'https://registry.npmjs.org' - - run: npm i -g npm@8 - - run: npm ci - - run: npm run build - - run: npx playwright install-deps - - run: node utils/build/update_canary_version.js --commit-timestamp - - run: utils/build/build-playwright-driver.sh - - run: utils/build/upload-playwright-driver.sh - env: - AZ_UPLOAD_FOLDER: driver/next - AZ_ACCOUNT_KEY: ${{ secrets.AZ_ACCOUNT_KEY }} - AZ_ACCOUNT_NAME: ${{ secrets.AZ_ACCOUNT_NAME }} diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml index 0ec8760314..8318a5a108 100644 --- a/.github/workflows/tests_secondary.yml +++ b/.github/workflows/tests_secondary.yml @@ -709,5 +709,4 @@ jobs: - run: npm ci - run: npm run build - run: npx playwright install-deps - - run: node utils/build/update_canary_version.js --today-date - run: utils/build/build-playwright-driver.sh diff --git a/utils/build/update_canary_version.js b/utils/build/update_canary_version.js index a611c1b6a4..43004e8c70 100755 --- a/utils/build/update_canary_version.js +++ b/utils/build/update_canary_version.js @@ -20,17 +20,28 @@ const path = require('path'); const { execSync } = require('child_process'); const packageJSON = require('../../package.json'); -if (process.argv[2] === '--today-date') { +const baseVersion = packageJSON.version.split('-')[0]; + +let prefix = ''; +if (process.argv[2] === '--alpha') { + prefix = 'alpha'; +} else if (process.argv[2] === '--beta') { + prefix = 'beta'; +} else { + throw new Error('only --alpha or --beta prefixes are allowed'); +} + +if (process.argv[3] === '--today-date') { const date = new Date(); const month = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'][date.getMonth()]; const day = date.getDate(); const year = date.getFullYear(); - packageJSON.version = `${packageJSON.version}-alpha-${month}-${day}-${year}`; -} else if (process.argv[2] === '--commit-timestamp') { + packageJSON.version = `${baseVersion}-${prefix}-${month}-${day}-${year}`; +} else if (process.argv[3] === '--commit-timestamp') { const timestamp = execSync('git show -s --format=%ct HEAD', { stdio: ['ignore', 'pipe', 'ignore'] }).toString('utf8').trim(); - packageJSON.version = `${packageJSON.version}-${timestamp}000`; + packageJSON.version = `${baseVersion}-${prefix}-${timestamp}000`; } else { throw new Error('This script must be run with either --commit-timestamp or --today-date parameter'); } diff --git a/utils/publish_all_packages.sh b/utils/publish_all_packages.sh index 459df1c847..fd16514006 100755 --- a/utils/publish_all_packages.sh +++ b/utils/publish_all_packages.sh @@ -15,18 +15,19 @@ trap "cleanup; cd $(pwd -P)" EXIT cd "$(dirname $0)" if [[ $1 == "--help" ]]; then - echo "usage: $(basename $0) [--release|--next|--beta]" + echo "usage: $(basename $0) [--release|--release-candidate|--alpha|--beta]" echo echo "Publishes all packages." echo echo "--release publish @latest version of all packages" - echo "--next publish @next version of all packages" + echo "--release-candidate publish @rc version of all packages" + echo "--alpha publish @next version of all packages" echo "--beta publish @beta version of all packages" exit 1 fi if [[ $# < 1 ]]; then - echo "Please specify either --release, --beta or --next" + echo "Please specify either --release, --beta or --alpha or --release-candidate" exit 1 fi @@ -68,17 +69,17 @@ elif [[ "$1" == "--release-candidate" ]]; then 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" +elif [[ "$1" == "--alpha" ]]; then + # Ensure package version contains alpha and does not contain rc + if [[ "${VERSION}" != *-alpha* || "${VERSION}" == *-rc* ]]; then + echo "ERROR: cannot publish release version with --alpha flag" exit 1 fi NPM_PUBLISH_TAG="next" elif [[ "$1" == "--beta" ]]; then # Ensure package version contains dash. - if [[ "${VERSION}" != *-* ]]; then + if [[ "${VERSION}" != *-beta* || "${VERSION}" == *-rc* ]]; then echo "ERROR: cannot publish release version with --beta flag" exit 1 fi