feat: first commit

This commit is contained in:
2024-10-06 22:34:39 +08:00
parent c3e9208e3a
commit 206d9eb926
12 changed files with 2621 additions and 0 deletions

33
index.mjs Normal file
View File

@ -0,0 +1,33 @@
import { exec as execCallback } from 'node:child_process';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { promisify } from 'node:util';
const exec = promisify(execCallback);
const self_cwd = dirname(fileURLToPath(import.meta.url));
import packageJson from './package.json' with { type: "json" };
// https://github.dev/cycjimmy/semantic-release-action
async function installDependencies() {
// const _extras = extras.replace(/['"]/g, '').replace(/[\n\r]/g, ' ');
const deps = ['semantic-release'].join(' ');
const { stdout, stderr } = await exec(`npm install ${deps} --no-audit --no-save`, {
cwd: self_cwd
});
console.log(stdout);
}
async function runRelease() {
const semanticRelease = await import('semantic-release');
const result = await semanticRelease.default(
{
plugins: packageJson.release.plugins,
dryRun: process.env.CI ? false : true,
},
);
// console.debug(`nextRelease.version :>> `, nextRelease.version);
// if (process.env.GITHUB_OUTPUT) fs.writeFileSync(process.env.GITHUB_OUTPUT, `NEXT_RELEASE_VERSION=${nextRelease.version}`);
return result;
}
if (process.env.CI) await installDependencies();
await runRelease();