1
1
mirror of https://github.com/primer/css.git synced 2024-11-26 23:56:04 +03:00

chore: update script/publish-storybook for actions

This commit is contained in:
Shawn Allen 2019-02-04 12:35:41 -08:00
parent 81038f631d
commit 3b65d3a4b3

View File

@ -1,23 +1,24 @@
#!/usr/bin/env node
const ghpages = require('gh-pages')
const {GITHUB_ACTOR, GITHUB_TOKEN} = process.env
if (!process.env.GH_TOKEN) {
console.error('Publish storybook: No GH_TOKEN found for storybook publishing.')
if (GITHUB_TOKEN) {
console.error('Publish storybook: No GITHUB_TOKEN found for storybook publishing.')
process.exitCode = 1
return
}
ghpages.publish('build',{
ghpages.publish('build', {
branch: 'gh-pages',
repo: `https://primer-css:${process.env.GH_TOKEN}@github.com/primer/storybook.git`,
repo: `https://${GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/primer/storybook.git`,
user: {
name: 'Primer CSS',
email: 'design-systems@github.com'
}
}, (error) => {
if(error) {
console.error('gh-pages failed to publish:', error.message.replace(process.env.GH_TOKEN, ''))
}, error => {
if (error) {
console.error('gh-pages failed to publish:', error.message.replace(process.env.GITHUB_TOKEN, '[secret]'))
process.exitCode = 1
}
})