-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
36 lines (27 loc) · 1.09 KB
/
index.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
31
32
33
34
35
36
const core = require('@actions/core');
const exec = require('@actions/exec');
async function run() {
try {
let hostingUrl = '';
const options = {};
options.listeners = {
stdout: (data) => {
hostingUrl = data.toString();
}
};
console.log('Deploying React Application to Firebase Hosting');
// Get the Firebase Token
process.env.FIREBASE_TOKEN = core.getInput('firebase-token');
process.env.INSTALL_FIREBASE = core.getInput('install-firebase');
process.env.BUILD_APPLICATION = core.getInput('build-application');
await exec.exec(`bash ${__dirname}/deploy.sh`, [], options);
// Process the output to get the url
hostingUrl = hostingUrl.substring(hostingUrl.lastIndexOf('Hosting URL: '))
hostingUrl = hostingUrl.substring(hostingUrl.lastIndexOf('https://'))
core.setOutput('hosting-url', hostingUrl);
console.log('Deployment completed to Url :', hostingUrl);
} catch (error) {
core.setFailed('Script Failed', error.message);
}
}
run();