Release bot (#2836)
* fix(ci): improve release-bot message by dynamically generating packageMap * fix(ci): update changeset to refresh lockfile after version
This commit is contained in:
parent
0a498d7289
commit
9219d5e1c0
2 changed files with 17 additions and 15 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -224,6 +224,8 @@ jobs:
|
||||||
id: changesets
|
id: changesets
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@v1
|
||||||
with:
|
with:
|
||||||
|
# Note: pnpm install after versioning is necessary to refresh lockfile
|
||||||
|
version: pnpm exec changeset version && pnpm install
|
||||||
publish: pnpm exec changeset publish
|
publish: pnpm exec changeset publish
|
||||||
commit: '[ci] release'
|
commit: '[ci] release'
|
||||||
title: '[ci] release'
|
title: '[ci] release'
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import { globby as glob } from 'globby';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import { readFile } from 'node:fs/promises'
|
||||||
|
|
||||||
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
|
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
|
||||||
|
|
||||||
const emojis = ['🎉', '🥳', '🚀', '🧑🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌'];
|
const emojis = ['🎉', '🥳', '🚀', '🧑🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌'];
|
||||||
|
@ -50,23 +54,19 @@ function singularlize(text) {
|
||||||
return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => `${match}`);
|
return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => `${match}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const packageMap = new Map([
|
const packageMap = new Map();
|
||||||
['astro', './packages/astro'],
|
async function generatePackageMap() {
|
||||||
['@astrojs/parser', './packages/astro-parser'],
|
const packageRoot = new URL('../../packages/', import.meta.url);
|
||||||
['@astrojs/prism', './packages/astro-prism'],
|
const packages = await glob(['*/package.json', '*/*/package.json'], { cwd: fileURLToPath(packageRoot) })
|
||||||
['create-astro', './packages/create-astro'],
|
await Promise.all(packages.map(async (pkg) => {
|
||||||
['@astrojs/markdown-remark', './packages/markdown/remark'],
|
const pkgFile = fileURLToPath(new URL(pkg, packageRoot));
|
||||||
['@astrojs/renderer-lit', './packages/renderers/renderer-lit'],
|
const content = await readFile(pkgFile).then(res => JSON.parse(res.toString()))
|
||||||
['@astrojs/renderer-preact', './packages/renderers/renderer-preact'],
|
packageMap.set(content.name, `./packages/${pkg.replace('/package.json', '')}`);
|
||||||
['@astrojs/renderer-react', './packages/renderers/renderer-react'],
|
}))
|
||||||
['@astrojs/renderer-solid', './packages/renderers/renderer-solid'],
|
}
|
||||||
['@astrojs/renderer-solid', './packages/renderers/renderer-solid'],
|
|
||||||
['@astrojs/renderer-svelte', './packages/renderers/renderer-svelte'],
|
|
||||||
['@astrojs/renderer-vue', './packages/renderers/renderer-vue'],
|
|
||||||
['@astrojs/webapi', './packages/webapi'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
await generatePackageMap();
|
||||||
const releases = process.argv.slice(2)[0];
|
const releases = process.argv.slice(2)[0];
|
||||||
const data = JSON.parse(releases);
|
const data = JSON.parse(releases);
|
||||||
const packages = await Promise.all(
|
const packages = await Promise.all(
|
||||||
|
|
Loading…
Add table
Reference in a new issue