-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-release.mjs
46 lines (35 loc) · 977 Bytes
/
generate-release.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { exec as execImpl } from 'node:child_process';
import { promisify } from 'node:util';
import { setgid, setuid } from 'node:process';
const exec = promisify(execImpl);
const main = async () => {
setuid('root');
setgid('root');
if (!existsSync('deb')) {
console.log('No pending releases. Exiting.');
return;
}
const versionFile = await readFile('current.txt');
const version = versionFile.toString();
await exec(
'git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"'
);
await exec(
'git config --global user.name "github-actions[bot]"'
);
await exec(
'git add current.txt'
);
await exec(
`git commit -m "Komga version updated to ${version}."`
);
await exec(
'git push origin master'
);
await exec(
`gh release create ${version} deb/*.deb`
);
};
main().catch(console.error);