refactor: remove canary release workflows (#13794)

now using continuous release with pkg.pr.new
This commit is contained in:
edison 2025-09-02 17:12:42 +08:00 committed by GitHub
parent 26bce3dc6c
commit 7171defb45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 181 deletions

View File

@ -1,33 +0,0 @@
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@v5
with:
ref: minor
- name: Install pnpm
uses: pnpm/action-setup@v4.1.0
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: pnpm install
- run: pnpm release --canary --publish --tag minor
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -1,31 +0,0 @@
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@v5
- name: Install pnpm
uses: pnpm/action-setup@v4.1.0
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: pnpm install
- run: pnpm release --canary --publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -135,8 +135,7 @@ function createConfig(format, output, plugins = []) {
const isServerRenderer = name === 'server-renderer' const isServerRenderer = name === 'server-renderer'
const isCJSBuild = format === 'cjs' const isCJSBuild = format === 'cjs'
const isGlobalBuild = /global/.test(format) const isGlobalBuild = /global/.test(format)
const isCompatPackage = const isCompatPackage = pkg.name === '@vue/compat'
pkg.name === '@vue/compat' || pkg.name === '@vue/compat-canary'
const isCompatBuild = !!packageOptions.compat const isCompatBuild = !!packageOptions.compat
const isBrowserBuild = const isBrowserBuild =
(isGlobalBuild || isBrowserESMBuild || isBundlerESMBuild) && (isGlobalBuild || isBrowserESMBuild || isBundlerESMBuild) &&
@ -288,10 +287,7 @@ function createConfig(format, output, plugins = []) {
// requires a ton of template engines which should be ignored. // requires a ton of template engines which should be ignored.
/** @type {ReadonlyArray<string>} */ /** @type {ReadonlyArray<string>} */
let cjsIgnores = [] let cjsIgnores = []
if ( if (pkg.name === '@vue/compiler-sfc') {
pkg.name === '@vue/compiler-sfc' ||
pkg.name === '@vue/compiler-sfc-canary'
) {
cjsIgnores = [ cjsIgnores = [
...Object.keys(consolidatePkg.devDependencies), ...Object.keys(consolidatePkg.devDependencies),
'vm', 'vm',

View File

@ -36,9 +36,6 @@ const { values: args, positionals } = parseArgs({
tag: { tag: {
type: 'string', type: 'string',
}, },
canary: {
type: 'boolean',
},
skipBuild: { skipBuild: {
type: 'boolean', type: 'boolean',
}, },
@ -69,9 +66,8 @@ const isDryRun = args.dry
/** @type {boolean | undefined} */ /** @type {boolean | undefined} */
let skipTests = args.skipTests let skipTests = args.skipTests
const skipBuild = args.skipBuild const skipBuild = args.skipBuild
const isCanary = args.canary const skipPrompts = args.skipPrompts
const skipPrompts = args.skipPrompts || args.canary const skipGit = args.skipGit
const skipGit = args.skipGit || args.canary
const packages = fs const packages = fs
.readdirSync(path.resolve(__dirname, '../packages')) .readdirSync(path.resolve(__dirname, '../packages'))
@ -98,18 +94,6 @@ const isCorePackage = (/** @type {string} */ pkgName) => {
) )
} }
const renamePackageToCanary = (/** @type {string} */ pkgName) => {
if (pkgName === 'vue') {
return '@vue/canary'
}
if (isCorePackage(pkgName)) {
return `${pkgName}-canary`
}
return pkgName
}
const keepThePackageName = (/** @type {string} */ pkgName) => pkgName const keepThePackageName = (/** @type {string} */ pkgName) => pkgName
/** @type {string[]} */ /** @type {string[]} */
@ -151,57 +135,6 @@ async function main() {
let targetVersion = positionals[0] let targetVersion = positionals[0]
if (isCanary) {
// 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()
const MM = (date.getUTCMonth() + 1).toString().padStart(2, '0')
const dd = date.getUTCDate().toString().padStart(2, '0')
const major = semver.major(currentVersion)
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
try {
const pkgName = renamePackageToCanary('vue')
const { stdout } = await run(
'pnpm',
['view', `${pkgName}@~${canaryVersion}`, 'version', '--json'],
{ stdio: 'pipe' },
)
let versions = JSON.parse(/** @type {string} */ (stdout))
versions = Array.isArray(versions) ? versions : [versions]
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 (/** @type {any} */ e) {
if (/E404/.test(e.message)) {
// the first patch version on that day
} else {
throw e
}
}
targetVersion = canaryVersion
}
if (!targetVersion) { if (!targetVersion) {
// no explicit version, offer suggestions // no explicit version, offer suggestions
/** @type {{ release: string }} */ /** @type {{ release: string }} */
@ -239,11 +172,7 @@ async function main() {
} }
if (skipPrompts) { if (skipPrompts) {
step( step(`Releasing v${targetVersion}...`)
isCanary
? `Releasing canary version v${targetVersion}...`
: `Releasing v${targetVersion}...`,
)
} else { } else {
/** @type {{ yes: boolean }} */ /** @type {{ yes: boolean }} */
const { yes: confirmRelease } = await prompt({ const { yes: confirmRelease } = await prompt({
@ -261,10 +190,7 @@ async function main() {
// update all package versions and inter-dependencies // update all package versions and inter-dependencies
step('\nUpdating cross dependencies...') step('\nUpdating cross dependencies...')
updateVersions( updateVersions(targetVersion, keepThePackageName)
targetVersion,
isCanary ? renamePackageToCanary : keepThePackageName,
)
versionUpdated = true versionUpdated = true
// generate changelog // generate changelog
@ -285,11 +211,8 @@ async function main() {
} }
// update pnpm-lock.yaml // update pnpm-lock.yaml
// skipped during canary release because the package names changed and installing with `workspace:*` would fail
if (!isCanary) {
step('\nUpdating lockfile...') step('\nUpdating lockfile...')
await run(`pnpm`, ['install', '--prefer-offline']) await run(`pnpm`, ['install', '--prefer-offline'])
}
if (!skipGit) { if (!skipGit) {
const { stdout } = await run('git', ['diff'], { stdio: 'pipe' }) const { stdout } = await run('git', ['diff'], { stdio: 'pipe' })
@ -457,34 +380,9 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')) const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
pkg.name = getNewPackageName(pkg.name) pkg.name = getNewPackageName(pkg.name)
pkg.version = version pkg.version = version
if (isCanary) {
updateDeps(pkg, 'dependencies', version, getNewPackageName)
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
}
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
} }
/**
* @param {Package} pkg
* @param {'dependencies' | 'peerDependencies'} depType
* @param {string} version
* @param {(pkgName: string) => string} getNewPackageName
*/
function updateDeps(pkg, depType, version, getNewPackageName) {
const deps = pkg[depType]
if (!deps) return
Object.keys(deps).forEach(dep => {
if (isCorePackage(dep)) {
const newName = getNewPackageName(dep)
const newVersion = newName === dep ? version : `npm:${newName}@${version}`
console.log(
pico.yellow(`${pkg.name} -> ${depType} -> ${dep}@${newVersion}`),
)
deps[dep] = newVersion
}
})
}
async function buildPackages() { async function buildPackages() {
step('\nBuilding all packages...') step('\nBuilding all packages...')
if (!skipBuild) { if (!skipBuild) {
@ -509,9 +407,8 @@ async function publishPackages(version) {
additionalPublishFlags.push('--no-git-checks') additionalPublishFlags.push('--no-git-checks')
} }
// add provenance metadata when releasing from CI // add provenance metadata when releasing from CI
// canary release commits are not pushed therefore we don't need to add provenance // skip provenance if not publishing to actual npm
// also skip provenance if not publishing to actual npm if (process.env.CI && !args.registry) {
if (process.env.CI && !isCanary && !args.registry) {
additionalPublishFlags.push('--provenance') additionalPublishFlags.push('--provenance')
} }