storybooks/storybook-deployer

Name: storybook-deployer

Owner: Storybook

Description: Deploy your storybook as a static site

Created: 2016-05-06 12:22:39.0

Updated: 2018-01-14 08:29:32.0

Pushed: 2017-12-12 17:30:16.0

Homepage: null

Size: 38

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Storybook Deployer

This is a simple tool allows you to deploy your Storybook into a static hosting service. (Currently, GitHub Pages only.)

Getting Started

Install Storybook Deployer with:

i @storybook/storybook-deployer --save-dev

Then add a NPM script like this:


cripts": {
"deploy-storybook": "storybook-to-ghpages",


Then you can run npm run deploy-storybook to deploy the Storybook to GitHub Pages.

Custom Build Configuration

If you customize the build configuration with some additional params (like static file directory), then you need to expose another NPM script like this:


cripts": {
"build-storybook": "build-storybook -s public -o .out",


Make sure to set the output directory as .out.

Skip Build Step

If you have previously built your storybook output (through a different CI step, etc) and just need to publish it, specify the directory like this:

run deploy-storybook -- --existing-output-dir=.out
Deploying Storybook as part of a CI service

To deploy Storybook as part of a CI step, pass the ci flag to npm run deploy-storybook.

Because pushing to GitHub as part of a CI step requires a personal access token, Storybook uses the GH_TOKEN environment variable, by default, to authenticate GitHub pushes.

This environment variable name can be configured via the host-token-env-variable flag.

For example, if your access token is stored in the GH_TOKEN environment variable

run deploy-storybook -- --ci

Or if your access token is stored in the GITHUB_TOKEN environment variable

run deploy-storybook -- --ci --host-token-env-variable=GITHUB_TOKEN
Custom deploy configuration

If you want to customize Git username, email or commit message, add this to package.json:

rybook-deployer": {
itUsername": "Custom Username",
itEmail": "custom@email.com",
ommitMessage": "Deploy Storybook [skip ci]"

It will override the default configuration:

rybook-deployer": {
itUsername": "GH Pages Bot",
itEmail": "hello@ghbot.com",
ommitMessage": "Deploy Storybook to GitHub Pages"

To deploy Storybook to a remote other than origin, pass a --remote flag to npm run deploy-storybook. For example, to deploy to your upstream remote:

run deploy-storybook -- --remote=upstream

Or, to specify a target branch and serve your storybook with rawgit instead of gh-pages:

run deploy-storybook -- --branch=feature-branch

Or, to specify a source branch other than master, pass a --source-branch flag to npm run deploy-storybook:

run deploy-storybook -- --source-branch=release

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.