mirror of https://github.com/vuejs/core.git
ci: add a canary release workflow for next minor (#9265)
This commit is contained in:
parent
831e180010
commit
b8fc18c0b2
|
@ -0,0 +1,33 @@
|
|||
name: canary minor 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:
|
||||
ref: minor
|
||||
|
||||
- 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 minor
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@ -12,7 +12,15 @@ 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'
|
||||
}
|
||||
})
|
||||
|
||||
const preId = args.preid || semver.prerelease(currentVersion)?.[0]
|
||||
const isDryRun = args.dry
|
||||
let skipTests = args.skipTests
|
||||
|
@ -74,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-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()
|
||||
|
@ -82,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
|
||||
|
@ -100,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
|
||||
|
|
Loading…
Reference in New Issue