Skip to content

Commit 7171def

Browse files
authored
refactor: remove canary release workflows (#13794)
now using continuous release with pkg.pr.new
1 parent 26bce3d commit 7171def

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
@@ -135,8 +135,7 @@ function createConfig(format, output, plugins = []) {
135135
const isServerRenderer = name === 'server-renderer'
136136
const isCJSBuild = format === 'cjs'
137137
const isGlobalBuild = /global/.test(format)
138-
const isCompatPackage =
139-
pkg.name === '@vue/compat' || pkg.name === '@vue/compat-canary'
138+
const isCompatPackage = pkg.name === '@vue/compat'
140139
const isCompatBuild = !!packageOptions.compat
141140
const isBrowserBuild =
142141
(isGlobalBuild || isBrowserESMBuild || isBundlerESMBuild) &&
@@ -288,10 +287,7 @@ function createConfig(format, output, plugins = []) {
288287
// requires a ton of template engines which should be ignored.
289288
/** @type {ReadonlyArray<string>} */
290289
let cjsIgnores = []
291-
if (
292-
pkg.name === '@vue/compiler-sfc' ||
293-
pkg.name === '@vue/compiler-sfc-canary'
294-
) {
290+
if (pkg.name === '@vue/compiler-sfc') {
295291
cjsIgnores = [
296292
...Object.keys(consolidatePkg.devDependencies),
297293
'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' })
@@ -457,34 +380,9 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
457380
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
458381
pkg.name = getNewPackageName(pkg.name)
459382
pkg.version = version
460-
if (isCanary) {
461-
updateDeps(pkg, 'dependencies', version, getNewPackageName)
462-
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
463-
}
464383
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
465384
}
466385

467-
/**
468-
* @param {Package} pkg
469-
* @param {'dependencies' | 'peerDependencies'} depType
470-
* @param {string} version
471-
* @param {(pkgName: string) => string} getNewPackageName
472-
*/
473-
function updateDeps(pkg, depType, version, getNewPackageName) {
474-
const deps = pkg[depType]
475-
if (!deps) return
476-
Object.keys(deps).forEach(dep => {
477-
if (isCorePackage(dep)) {
478-
const newName = getNewPackageName(dep)
479-
const newVersion = newName === dep ? version : `npm:${newName}@${version}`
480-
console.log(
481-
pico.yellow(`${pkg.name} -> ${depType} -> ${dep}@${newVersion}`),
482-
)
483-
deps[dep] = newVersion
484-
}
485-
})
486-
}
487-
488386
async function buildPackages() {
489387
step('\nBuilding all packages...')
490388
if (!skipBuild) {
@@ -509,9 +407,8 @@ async function publishPackages(version) {
509407
additionalPublishFlags.push('--no-git-checks')
510408
}
511409
// add provenance metadata when releasing from CI
512-
// canary release commits are not pushed therefore we don't need to add provenance
513-
// also skip provenance if not publishing to actual npm
514-
if (process.env.CI && !isCanary && !args.registry) {
410+
// skip provenance if not publishing to actual npm
411+
if (process.env.CI && !args.registry) {
515412
additionalPublishFlags.push('--provenance')
516413
}
517414

0 commit comments

Comments
 (0)