ci: implement workflow to publish dev versions (#11120)

* ci: implement workflow to publish dev versions

* ci: refactor into the other dev job

* fix: use dev tag

* chore: clarify

* fix: always use actions from main

* fix: conditionally

* chore: don't ask for meaningless perm
This commit is contained in:
Denis-Adrian Cristea
2025-10-08 14:08:39 +03:00
committed by GitHub
parent fcf7f27fd7
commit 0c2975e3fd
5 changed files with 93 additions and 21 deletions

View File

@@ -30,15 +30,29 @@ program
)
.option('--dry', 'skips actual publishing and outputs logs instead', dryInput)
.option('--dev', 'publishes development versions and skips tagging / github releases', devInput)
.option('--tag <tag>', 'tag to use for dev releases (defaults to "dev")', getInput('tag'))
.parse();
const { exclude, dry, dev } = program.opts<{ dev: boolean; dry: boolean; exclude: string[] }>();
const [packageName] = program.processedArgs as [string];
const {
exclude,
dry,
dev,
tag: inputTag,
} = program.opts<{ dev: boolean; dry: boolean; exclude: string[]; tag: string }>();
// All this because getInput('tag') will return empty string when not set :P
if (!dev && inputTag.length) {
throw new Error('The --tag option can only be used with --dev');
}
const tag = inputTag.length ? inputTag : dev ? 'dev' : undefined;
const [packageName] = program.processedArgs as [string];
const tree = await generateReleaseTree(dry, tag, packageName, exclude);
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)));
await Promise.all(branch.map(async (release) => releasePackage(release, dry, tag)));
endGroup();
}