forked from paketo-buildpacks/paketo-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
29 lines (24 loc) · 859 Bytes
/
deploy.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
const firebase = require('firebase-tools');
const core = require('@actions/core');
module.exports = async ({ expires } = { expires: '1h'}) => {
const { GITHUB_HEAD_REF } = process.env;
var channelID = "pr";
if (GITHUB_HEAD_REF) {
channelID = GITHUB_HEAD_REF.split('/')
.filter(item => item.trim().length > 0)
.pop();
}
firebase
.hosting
.channel
.deploy(channelID, { json: true, expires, only: 'paketo-stage'})
.then((data) => {
console.log(`PR DEPLOYED TO: ${data['paketo-stage'].url}`)
console.log(`SITE EXPIRES AT: ${data['paketo-stage'].expireTime} (in ${expires})`)
core.setOutput("staging_url", data['paketo-stage'].url);
core.setOutput("expiration", `${data['paketo-stage'].expireTime} (in ${expires})`);
})
.catch((err) => {
console.log(`deploy: ${err}`);
});
}