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 pathfastlane.js
More file actions
41 lines (35 loc) · 1.27 KB
/
fastlane.js
File metadata and controls
41 lines (35 loc) · 1.27 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
const core = require('@actions/core');
const cp = require('child_process');
const styles = require('ansi-styles');
const re = /---\\n- !.*/g;
module.exports = function(keyFound) {
core.info(`${styles.cyanBright.open}===> Starting Fastlane!! This can take a couple minutes...`);
const cli = cp.spawn('bundle', ['exec', 'fastlane', 'spaceauth', '-u', core.getInput('apple_id')], {
env: {
...process.env,
FASTLANE_PASSWORD: core.getInput('apple_password'),
SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER: core.getInput('tfa_phone_number'),
}
});
const onData = (buf) => {
const str = buf.toString();
const match = re.exec(str);
if (match) {
keyFound(match[0]);
// Remove our listener!
core.info(`${styles.cyanBright.open}===> Found a key! Removing our stdout listener...`);
cli.stdout.removeListener('data', onData);
}
else {
console.log('OUT >>', str);
}
};
cli.stdout.on('data', onData);
cli.stderr.on('data', (data) => {
console.log('ERR: ', data.toString());
})
cli.on('exit', (code) => {
core.info(`${styles.cyanBright.open}===> Fastlane exited with code ${code}`);
});
return cli;
}