Add a job to create a release
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import esMain from 'es-main';
|
||||
import semver from 'semver';
|
||||
import {Octokit} from '@octokit/rest';
|
||||
|
||||
async function main() {
|
||||
export async function getLatestRelease() {
|
||||
const client = new Octokit();
|
||||
|
||||
let latest = '0.0.0';
|
||||
@@ -21,7 +22,15 @@ async function main() {
|
||||
}
|
||||
);
|
||||
|
||||
process.stdout.write(`v${latest}\n`);
|
||||
return latest;
|
||||
}
|
||||
|
||||
main();
|
||||
if (esMain(import.meta)) {
|
||||
getLatestRelease()
|
||||
.then((latest) => {
|
||||
process.stdout.write(`v${latest}\n`, () => process.exit(0));
|
||||
})
|
||||
.catch((err) => {
|
||||
process.stderr.write(`${err.message}\n`, () => process.exit(1));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user