-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.ts
48 lines (44 loc) · 1.07 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
import fs from 'fs';
const releaseVersion = process.argv.at(-1);
const files: Array<{
path: string;
search: RegExp;
replace: string;
}> = [
{
path: 'src-tauri/tauri.conf.json',
search: /"version": ".*"/,
replace: `"version": "${releaseVersion}"`,
},
{
path: 'package.json',
search: /"version": ".*"/,
replace: `"version": "${releaseVersion}"`,
},
{
path: 'src-tauri/Cargo.toml',
search: /version = ".*"/,
replace: `version = "${releaseVersion}"`,
},
{
path: 'src-tauri/Cargo.lock',
search: /name = "aptt"\nversion = ".*"/,
replace: `name = "aptt"\nversion = "${releaseVersion}"`,
},
{
path: '.github/workflows/release.yml',
search: / {10}releaseBody: \|\n.*\n {10}releaseDraft: false/s,
replace: ` releaseBody: | # AXXX
## New features
-
## Bug fixes
-
releaseDraft: false`,
},
];
files.forEach(({ path, search, replace }) => {
fs.writeFileSync(
path,
fs.readFileSync(path, 'utf8').replace(search, replace),
);
});