This repository was archived by the owner on Oct 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
49 lines (41 loc) · 1.26 KB
/
index.js
File metadata and controls
49 lines (41 loc) · 1.26 KB
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
const core = require('@actions/core');
const exec = require('@actions/exec');
const ngrok = require('ngrok');
const styles = require('ansi-styles');
const api = require('./rest');
const cli = require('./fastlane');
const secret = require('./secrets');
const plugins = require('./plugins');
// most @actions toolkit packages have async methods
async function run() {
try {
// Install Fastlane...
core.info(`${styles.cyanBright.open}===> Installing Fastlane!`);
await exec.exec('bundle install');
api(async (setStdin, stopListening) => {
const url = await ngrok.connect(9090);
core.info(`${styles.cyanBright.open}===> ngrok tunnel is ${url}`);
try {
await plugins(url);
}
catch (exc) {
core.setFailed(exc);
process.exit(1);
}
const spaceauth = cli(async (key) => {
// Turn off our HTTP services...
core.info(`${styles.cyanBright.open}===> Killing our ngrok tunnel`);
stopListening();
await ngrok.disconnect();
await ngrok.kill();
// Send our secret to GitHub...
// TODO: also make this plug-innable
secret(key);
});
setStdin(spaceauth.stdin);
});
} catch (error) {
core.setFailed(error.message);
}
}
run();