From 61acd944a41c8ade3f72b07ec8d49d5b1f83e0ef Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 21 Sep 2023 15:53:01 +0800 Subject: [PATCH 1/8] build: add kebab-case aliases for release script options --- scripts/release.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/release.js b/scripts/release.js index 2c91cbbafac..11922dd24aa 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -12,7 +12,16 @@ import { fileURLToPath } from 'node:url' const { prompt } = enquirer const currentVersion = createRequire(import.meta.url)('../package.json').version const __dirname = path.dirname(fileURLToPath(import.meta.url)) -const args = minimist(process.argv.slice(2)) +const args = minimist(process.argv.slice(2), { + alias: { + skipBuild: 'skip-build', + skipTests: 'skip-tests', + skipGit: 'skip-git', + skipPrompts: 'skip-prompts', + distTag: 'dist-tag' + } +}) + const preId = args.preid || semver.prerelease(currentVersion)?.[0] const isDryRun = args.dry let skipTests = args.skipTests From a2079aa614fd02c08590de87b3b6d93a20111cb2 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 21 Sep 2023 16:58:03 +0800 Subject: [PATCH 2/8] ci: add a canary release workflow for next minor --- .github/workflows/canary-next-minor.yml | 34 +++++++++++++++++++++++++ scripts/release.js | 21 ++++++++++----- 2 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/canary-next-minor.yml diff --git a/.github/workflows/canary-next-minor.yml b/.github/workflows/canary-next-minor.yml new file mode 100644 index 00000000000..9a7384a6238 --- /dev/null +++ b/.github/workflows/canary-next-minor.yml @@ -0,0 +1,34 @@ +name: canary release +on: + # Runs every Monday at 1 AM UTC (9:00 AM in Singapore) + schedule: + - cron: 0 1 * * MON + workflow_dispatch: + +jobs: + canary: + # prevents this action from running on forks + if: github.repository == 'vuejs/core' + runs-on: ubuntu-latest + environment: Release + steps: + - uses: actions/checkout@v4 + with: + # TODO: maybe we can have a "next-minor" branch so that we don't need to update this every time + ref: 3.4 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - name: Set node version to 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: 'https://registry.npmjs.org' + cache: 'pnpm' + + - run: pnpm install + + - run: pnpm release --canary --tag next-minor + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/scripts/release.js b/scripts/release.js index 11922dd24aa..edbc79a8ddf 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -17,8 +17,7 @@ const args = minimist(process.argv.slice(2), { skipBuild: 'skip-build', skipTests: 'skip-tests', skipGit: 'skip-git', - skipPrompts: 'skip-prompts', - distTag: 'dist-tag' + skipPrompts: 'skip-prompts' } }) @@ -83,7 +82,7 @@ async function main() { let targetVersion = args._[0] if (isCanary) { - // The canary version string format is `3.yyyyMMdd.0`. + // The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-next-minor.0` for next-minor) // Use UTC date so that it's consistent across CI and maintainers' machines const date = new Date() const yyyy = date.getUTCFullYear() @@ -91,9 +90,13 @@ async function main() { const dd = date.getUTCDate().toString().padStart(2, '0') const major = semver.major(currentVersion) - const minor = `${yyyy}${MM}${dd}` - const patch = 0 - let canaryVersion = `${major}.${minor}.${patch}` + const datestamp = `${yyyy}${MM}${dd}` + let canaryVersion + + canaryVersion = `${major}.${datestamp}.0` + if (args.tag && args.tag !== 'latest') { + canaryVersion = `${major}.${datestamp}.0-${args.tag}.0` + } // check the registry to avoid version collision // in case we need to publish more than one canary versions in a day @@ -109,9 +112,15 @@ async function main() { const latestSameDayPatch = /** @type {string} */ ( semver.maxSatisfying(versions, `~${canaryVersion}`) ) + canaryVersion = /** @type {string} */ ( semver.inc(latestSameDayPatch, 'patch') ) + if (args.tag && args.tag !== 'latest') { + canaryVersion = /** @type {string} */ ( + semver.inc(latestSameDayPatch, 'prerelease', args.tag) + ) + } } catch (e) { if (/E404/.test(e.message)) { // the first patch version on that day From 4fd558dc83d856516113d6afd167a72a93df0949 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 22 Sep 2023 14:43:59 +0800 Subject: [PATCH 3/8] Update .github/workflows/canary-next-minor.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 Kevin Deng --- .github/workflows/canary-next-minor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/canary-next-minor.yml b/.github/workflows/canary-next-minor.yml index 9a7384a6238..2c1d642d946 100644 --- a/.github/workflows/canary-next-minor.yml +++ b/.github/workflows/canary-next-minor.yml @@ -1,4 +1,4 @@ -name: canary release +name: canary minor release on: # Runs every Monday at 1 AM UTC (9:00 AM in Singapore) schedule: From 84b790959acdeee16472d2a2b18cd084504f2564 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 22 Sep 2023 14:44:05 +0800 Subject: [PATCH 4/8] Update .github/workflows/canary-next-minor.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 Kevin Deng --- .github/workflows/canary-next-minor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/canary-next-minor.yml b/.github/workflows/canary-next-minor.yml index 2c1d642d946..5e3c7d5c9f5 100644 --- a/.github/workflows/canary-next-minor.yml +++ b/.github/workflows/canary-next-minor.yml @@ -29,6 +29,6 @@ jobs: - run: pnpm install - - run: pnpm release --canary --tag next-minor + - run: pnpm release --canary --tag minor env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 11d7b4b069d4a1fd5e88a9b0d20adcdb3dfb3992 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 22 Sep 2023 14:44:11 +0800 Subject: [PATCH 5/8] Update scripts/release.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 Kevin Deng --- scripts/release.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.js b/scripts/release.js index edbc79a8ddf..967a2c0b622 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -82,7 +82,7 @@ async function main() { let targetVersion = args._[0] if (isCanary) { - // The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-next-minor.0` for next-minor) + // The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for next-minor) // Use UTC date so that it's consistent across CI and maintainers' machines const date = new Date() const yyyy = date.getUTCFullYear() From 8aba7bade64d7c32b687c3981a674d3419620046 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 22 Sep 2023 14:44:56 +0800 Subject: [PATCH 6/8] chore: rename to canary-minor.yml --- .github/workflows/{canary-next-minor.yml => canary-minor.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{canary-next-minor.yml => canary-minor.yml} (100%) diff --git a/.github/workflows/canary-next-minor.yml b/.github/workflows/canary-minor.yml similarity index 100% rename from .github/workflows/canary-next-minor.yml rename to .github/workflows/canary-minor.yml From 0a234d6af28161d3ca959529960ae1274889a9b0 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 22 Sep 2023 14:45:47 +0800 Subject: [PATCH 7/8] chore: change the branch name to `minor` --- .github/workflows/canary-minor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/canary-minor.yml b/.github/workflows/canary-minor.yml index 5e3c7d5c9f5..2aa6db12b36 100644 --- a/.github/workflows/canary-minor.yml +++ b/.github/workflows/canary-minor.yml @@ -14,8 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - # TODO: maybe we can have a "next-minor" branch so that we don't need to update this every time - ref: 3.4 + ref: minor - name: Install pnpm uses: pnpm/action-setup@v2 From b8160b81fb36501dedcfcaace8b56b1d32615058 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 22 Sep 2023 15:41:00 +0800 Subject: [PATCH 8/8] Update scripts/release.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 Kevin Deng --- scripts/release.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.js b/scripts/release.js index 967a2c0b622..861fd106abc 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -82,7 +82,7 @@ async function main() { let targetVersion = args._[0] if (isCanary) { - // The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for next-minor) + // The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor) // Use UTC date so that it's consistent across CI and maintainers' machines const date = new Date() const yyyy = date.getUTCFullYear()