Skip to content

Commit 8ab3e07

Browse files
edison11059romise
authored andcommitted
refactor: remove canary release workflows (#13794)
now using continuous release with pkg.pr.new
1 parent 763912d commit 8ab3e07

File tree

4 files changed

+10
-181
lines changed

4 files changed

+10
-181
lines changed

.github/workflows/canary-minor.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/canary.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

rollup.config.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ function createConfig(format, output, plugins = []) {
145145
const isServerRenderer = name === 'server-renderer'
146146
const isCJSBuild = format === 'cjs'
147147
const isGlobalBuild = /global/.test(format)
148-
const isCompatPackage =
149-
pkg.name === '@vue/compat' || pkg.name === '@vue/compat-canary'
148+
const isCompatPackage = pkg.name === '@vue/compat'
150149
const isCompatBuild = !!packageOptions.compat
151150
const isBrowserBuild =
152151
(isGlobalBuild || isBrowserESMBuild || isBundlerESMBuild) &&
@@ -344,10 +343,7 @@ function createConfig(format, output, plugins = []) {
344343
// requires a ton of template engines which should be ignored.
345344
/** @type {ReadonlyArray<string>} */
346345
let cjsIgnores = []
347-
if (
348-
pkg.name === '@vue/compiler-sfc' ||
349-
pkg.name === '@vue/compiler-sfc-canary'
350-
) {
346+
if (pkg.name === '@vue/compiler-sfc') {
351347
cjsIgnores = [
352348
...Object.keys(consolidatePkg.devDependencies),
353349
'vm',

scripts/release.js

Lines changed: 8 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ const { values: args, positionals } = parseArgs({
3636
tag: {
3737
type: 'string',
3838
},
39-
canary: {
40-
type: 'boolean',
41-
},
4239
skipBuild: {
4340
type: 'boolean',
4441
},
@@ -69,9 +66,8 @@ const isDryRun = args.dry
6966
/** @type {boolean | undefined} */
7067
let skipTests = args.skipTests
7168
const skipBuild = args.skipBuild
72-
const isCanary = args.canary
73-
const skipPrompts = args.skipPrompts || args.canary
74-
const skipGit = args.skipGit || args.canary
69+
const skipPrompts = args.skipPrompts
70+
const skipGit = args.skipGit
7571

7672
const packages = fs
7773
.readdirSync(path.resolve(__dirname, '../packages'))
@@ -98,18 +94,6 @@ const isCorePackage = (/** @type {string} */ pkgName) => {
9894
)
9995
}
10096

101-
const renamePackageToCanary = (/** @type {string} */ pkgName) => {
102-
if (pkgName === 'vue') {
103-
return '@vue/canary'
104-
}
105-
106-
if (isCorePackage(pkgName)) {
107-
return `${pkgName}-canary`
108-
}
109-
110-
return pkgName
111-
}
112-
11397
const keepThePackageName = (/** @type {string} */ pkgName) => pkgName
11498

11599
/** @type {string[]} */
@@ -151,57 +135,6 @@ async function main() {
151135

152136
let targetVersion = positionals[0]
153137

154-
if (isCanary) {
155-
// The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor)
156-
// Use UTC date so that it's consistent across CI and maintainers' machines
157-
const date = new Date()
158-
const yyyy = date.getUTCFullYear()
159-
const MM = (date.getUTCMonth() + 1).toString().padStart(2, '0')
160-
const dd = date.getUTCDate().toString().padStart(2, '0')
161-
162-
const major = semver.major(currentVersion)
163-
const datestamp = `${yyyy}${MM}${dd}`
164-
let canaryVersion
165-
166-
canaryVersion = `${major}.${datestamp}.0`
167-
if (args.tag && args.tag !== 'latest') {
168-
canaryVersion = `${major}.${datestamp}.0-${args.tag}.0`
169-
}
170-
171-
// check the registry to avoid version collision
172-
// in case we need to publish more than one canary versions in a day
173-
try {
174-
const pkgName = renamePackageToCanary('vue')
175-
const { stdout } = await run(
176-
'pnpm',
177-
['view', `${pkgName}@~${canaryVersion}`, 'version', '--json'],
178-
{ stdio: 'pipe' },
179-
)
180-
let versions = JSON.parse(/** @type {string} */ (stdout))
181-
versions = Array.isArray(versions) ? versions : [versions]
182-
const latestSameDayPatch = /** @type {string} */ (
183-
semver.maxSatisfying(versions, `~${canaryVersion}`)
184-
)
185-
186-
canaryVersion = /** @type {string} */ (
187-
semver.inc(latestSameDayPatch, 'patch')
188-
)
189-
if (args.tag && args.tag !== 'latest') {
190-
canaryVersion = /** @type {string} */ (
191-
semver.inc(latestSameDayPatch, 'prerelease', args.tag)
192-
)
193-
}
194-
} catch (/** @type {any} */ e) {
195-
if (/E404/.test(e.message)) {
196-
// the first patch version on that day
197-
} else {
198-
throw e
199-
}
200-
}
201-
202-
targetVersion = canaryVersion
203-
}
204-
205138
if (!targetVersion) {
206139
// no explicit version, offer suggestions
207140
/** @type {{ release: string }} */
@@ -239,11 +172,7 @@ async function main() {
239172
}
240173

241174
if (skipPrompts) {
242-
step(
243-
isCanary
244-
? `Releasing canary version v${targetVersion}...`
245-
: `Releasing v${targetVersion}...`,
246-
)
175+
step(`Releasing v${targetVersion}...`)
247176
} else {
248177
/** @type {{ yes: boolean }} */
249178
const { yes: confirmRelease } = await prompt({
@@ -261,10 +190,7 @@ async function main() {
261190

262191
// update all package versions and inter-dependencies
263192
step('\nUpdating cross dependencies...')
264-
updateVersions(
265-
targetVersion,
266-
isCanary ? renamePackageToCanary : keepThePackageName,
267-
)
193+
updateVersions(targetVersion, keepThePackageName)
268194
versionUpdated = true
269195

270196
// generate changelog
@@ -285,11 +211,8 @@ async function main() {
285211
}
286212

287213
// update pnpm-lock.yaml
288-
// skipped during canary release because the package names changed and installing with `workspace:*` would fail
289-
if (!isCanary) {
290-
step('\nUpdating lockfile...')
291-
await run(`pnpm`, ['install', '--prefer-offline'])
292-
}
214+
step('\nUpdating lockfile...')
215+
await run(`pnpm`, ['install', '--prefer-offline'])
293216

294217
if (!skipGit) {
295218
const { stdout } = await run('git', ['diff'], { stdio: 'pipe' })
@@ -453,34 +376,9 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
453376
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
454377
pkg.name = getNewPackageName(pkg.name)
455378
pkg.version = version
456-
if (isCanary) {
457-
updateDeps(pkg, 'dependencies', version, getNewPackageName)
458-
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
459-
}
460379
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
461380
}
462381

463-
/**
464-
* @param {Package} pkg
465-
* @param {'dependencies' | 'peerDependencies'} depType
466-
* @param {string} version
467-
* @param {(pkgName: string) => string} getNewPackageName
468-
*/
469-
function updateDeps(pkg, depType, version, getNewPackageName) {
470-
const deps = pkg[depType]
471-
if (!deps) return
472-
Object.keys(deps).forEach(dep => {
473-
if (isCorePackage(dep)) {
474-
const newName = getNewPackageName(dep)
475-
const newVersion = newName === dep ? version : `npm:${newName}@${version}`
476-
console.log(
477-
pico.yellow(`${pkg.name} -> ${depType} -> ${dep}@${newVersion}`),
478-
)
479-
deps[dep] = newVersion
480-
}
481-
})
482-
}
483-
484382
async function buildPackages() {
485383
step('\nBuilding all packages...')
486384
if (!skipBuild) {
@@ -505,9 +403,8 @@ async function publishPackages(version) {
505403
additionalPublishFlags.push('--no-git-checks')
506404
}
507405
// add provenance metadata when releasing from CI
508-
// canary release commits are not pushed therefore we don't need to add provenance
509-
// also skip provenance if not publishing to actual npm
510-
if (process.env.CI && !isCanary && !args.registry) {
406+
// skip provenance if not publishing to actual npm
407+
if (process.env.CI && !args.registry) {
511408
additionalPublishFlags.push('--provenance')
512409
}
513410

0 commit comments

Comments
 (0)