forked from foundryvtt/pf2e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatebuildno.js
30 lines (25 loc) · 1.04 KB
/
updatebuildno.js
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
const yargs = require('yargs');
const fs = require('fs');
const argv = yargs
.option('buildno', {
type: 'number',
description: 'specifies the build number to be updated (CI_PIPELINE_IID)'
})
.option('branch', {
'type': 'string',
description: 'specifies the branch (CI_COMMIT_BRANCH)'
})
.option('gitlabpath', {
type: 'string',
description: 'The path on gitlab where this branch is stored (CI_PROJECT_PATH)'
})
.demandOption(['branch', 'buildno'])
.argv;
const systemRaw = fs.readFileSync('system.json');
let system = JSON.parse(systemRaw);
system.version = `${system.version}.${argv.buildno}`;
system.url = `https://gitlab.com/${argv.gitlabpath}`;
system.manifest = `https://gitlab.com/${argv.gitlabpath}/-/jobs/artifacts/${argv.branch}/raw/system.json?job=build`;
system.download = `https://gitlab.com/${argv.gitlabpath}/-/jobs/artifacts/${argv.branch}/raw/pf2e.zip?job=build`;
fs.writeFileSync('system.json', JSON.stringify(system, null, 2));
console.log(system.manifest);