ci: better release workflow (#10325)

* ci: better release workflow

* ci: simplify + use changelog

* ci(release): better parsing and exclusions

* ci(release): remove tree log

* ci(release): improve logs

* ci(release): properly check inputs

* ci(release): better promise handling

Co-authored-by: Aura <kyradiscord@gmail.com>

* ci: refactor release to use bun

* ci(release): whitespace

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>

* ci(release): add dev release handling

* ci(release): fixes from testing

* ci(release): make the promise run

* ci(release): when specifying package, skip exclusions

* ci(dev): create-discord-bot dev release

* ci(release): improve changelog detection

* ci: fix typo and allow releasing branches

* ci(release): set make_latest for gh releases

* ci(release): add ssh_key so pushed tags run workflow

---------

Co-authored-by: Aura <kyradiscord@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
ckohen
2025-07-25 02:56:02 -07:00
committed by GitHub
parent f2fec9177f
commit 6cdfa3864b
12 changed files with 646 additions and 22 deletions

View File

@@ -0,0 +1,47 @@
import { getInput, startGroup, endGroup, getBooleanInput, info } from '@actions/core';
import { program } from 'commander';
import { generateReleaseTree } from './generateReleaseTree.js';
import { releasePackage } from './releasePackage.js';
const excludeInput = getInput('exclude');
let dryInput = false;
let devInput = false;
try {
devInput = getBooleanInput('dev');
} catch {
// We're not running in actions
}
try {
dryInput = getBooleanInput('dry');
} catch {
// We're not running in actions or the input isn't set (cron)
}
program
.name('release packages')
.description('releases monorepo packages with proper sequencing')
.argument('[package]', "release a specific package (and it's dependencies)", getInput('package'))
.option(
'-e, --exclude <packages...>',
'exclude specific packages from releasing (will still release if necessary for another package)',
excludeInput ? excludeInput.split(',') : [],
)
.option('--dry', 'skips actual publishing and outputs logs instead', dryInput)
.option('--dev', 'publishes development versions and skips tagging / github releases', devInput)
.parse();
const { exclude, dry, dev } = program.opts<{ dev: boolean; dry: boolean; exclude: string[] }>();
const packageName = program.args[0]!;
const tree = await generateReleaseTree(dev, dry, packageName, exclude);
for (const branch of tree) {
startGroup(`Releasing ${branch.map((entry) => `${entry.name}@${entry.version}`).join(', ')}`);
await Promise.all(branch.map(async (release) => releasePackage(release, dev, dry)));
endGroup();
}
info(
`Successfully released ${tree.map((branch) => branch.map((entry) => `${entry.name}@${entry.version}`).join(', ')).join(', ')}`,
);