-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.ts
executable file
·54 lines (43 loc) · 1.23 KB
/
release.ts
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
47
48
49
50
51
52
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run
import {
increment,
ReleaseType,
} from 'https://deno.land/[email protected]/semver/mod.ts';
type TauriConfig = {
package: {
version: string;
};
};
const config: TauriConfig = JSON.parse(
Deno.readTextFileSync('./src-tauri/tauri.conf.json')
);
const newVer = increment(config.package.version, Deno.args[0] as ReleaseType);
if (newVer === null) {
console.error('Somethings went wrong updating the version, args:', Deno.args);
Deno.exit(1);
}
const newVerWithV = 'v' + newVer;
if (!confirm(`Do you want to publish ${newVerWithV}?`)) Deno.exit(0);
config.package.version = newVer;
Deno.writeTextFileSync(
'./src-tauri/tauri.conf.json',
JSON.stringify(config, null, '\t') + '\n'
);
const run = (args: string[]) => {
const process = Deno.run({ cmd: args, stdout: 'piped' });
return Promise.all([process.output(), process.status()]).then(() =>
process.close()
);
};
/*
git add .
git commit -m "[release] $1"
git push origin
git tag $1
git push origin $1
*/
await run(['git', 'add', '.']);
await run(['git', 'commit', '-m', `[release] ${newVerWithV}`]);
await run(['git', 'push', 'origin']);
await run(['git', 'tag', newVerWithV]);
await run(['git', 'push', 'origin', newVerWithV]);