-
Notifications
You must be signed in to change notification settings - Fork 0
/
trigger.ts
46 lines (40 loc) · 1.42 KB
/
trigger.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
import axios, { AxiosError, AxiosResponse } from "axios";
import {Octokit} from "octokit";
import { Command } from 'commander';
import 'dotenv/config';
async function main() {
const program = new Command();
program
.name('trigger')
.description('Trigger github action to install, build, and publish holochain prebuilt binaries')
.version('1.0.0')
.requiredOption('-c, --hc_version <string>', 'holochain_cli version')
.requiredOption('-h, --holochain_version <string>', 'holochain version')
.requiredOption('-l, --lair_version <string>', 'lair-keystore version')
.option('--linux-only', 'Only build & release for linux');
program.parse();
const { lair_version, holochain_version, hc_version, linuxOnly } = program.opts();
const octokit = new Octokit({
auth: process.env.GITHUB_AUTH_TOKEN
})
try {
await octokit.request('POST /repos/{owner}/{repo}/dispatches', {
owner: 'holochain-open-dev',
repo: 'holochain-prebuilt-binaries',
event_type: linuxOnly ? 'install-release-linux' : 'install-release-all',
client_payload: {
lair_version,
holochain_version,
hc_version,
},
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
});
console.log(`Triggered workflow for lair-keystore v${lair_version}, holochain_cli v${hc_version}, holochain v${holochain_version}` );
} catch(e) {
//@ts-ignore
console.error(e);
}
}
main();