mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-20 05:02:37 +08:00
Merge pull request #11462 from storybookjs/add-frontpage-build-hook-action
Deploy the `next` branch of frontpage too
This commit is contained in:
commit
17a69feb84
@ -4,19 +4,21 @@
|
||||
const fetch = require('node-fetch');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const { FRONTPAGE_WEBHOOK } = process.env;
|
||||
const { FRONTPAGE_WEBHOOK, FRONTPAGE_WEBHOOK_NEXT } = process.env;
|
||||
|
||||
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
||||
|
||||
const branchToHook = {
|
||||
master: FRONTPAGE_WEBHOOK,
|
||||
'6.0-docs': FRONTPAGE_WEBHOOK_NEXT, // <- NOTE: change this to `next` when we merge the new docs
|
||||
};
|
||||
|
||||
console.log('build-frontpage');
|
||||
if (branch === 'master') {
|
||||
if (FRONTPAGE_WEBHOOK) {
|
||||
console.log('triggering frontpage build');
|
||||
const url = `https://api.netlify.com/build_hooks/${FRONTPAGE_WEBHOOK}`;
|
||||
fetch(url, { method: 'post' }).then((res) => console.log('result', res.status));
|
||||
} else {
|
||||
console.log('no webhook defined');
|
||||
}
|
||||
const hook = branchToHook[branch];
|
||||
if (hook) {
|
||||
console.log('triggering frontpage build');
|
||||
const url = `https://api.netlify.com/build_hooks/${hook}`;
|
||||
fetch(url, { method: 'post' }).then((res) => console.log('result', res.status));
|
||||
} else {
|
||||
console.log('skipping branch', branch);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user