Giter VIP home page Giter VIP logo

github-actions-storybook-to-github-pages's Introduction

Deploy Storybook to GitHub Pages

bitovi/github-actions-storybook-to-github-pages builds and deploys a Storybook application to GitHub Pages.

This action uses the new GitHub Actions publishing method which allows you to create an artifact that contains the result of the build and serves the files in the artifact on the Pages site. There’s no need to check files back into your repository, keeping it nice and clean.

Action Summary

This action deploys Storybook to Github Pages. The build process should create static files and put them into a build direcory that will be moved into your Pages hosting location.

If you would like to deploy a backend app/service, check out our other actions:

Action Purpose
Deploy Docker to EC2 Deploys a repo with a Dockerized application to a virtual machine (EC2) on AWS
Deploy React to GitHub Pages Builds and deploys a React application to GitHub Pages.
Deploy static site to AWS (S3/CDN/R53) Hosts a static site in AWS S3 with CloudFront

And more!, check our list of actions in the GitHub marketplace

Need help or have questions?

This project is supported by Bitovi, A DevOps consultancy.

You can get help or ask questions on our:

Or, you can hire us for training, consulting, or development. Set up a free consultation.

Basic Use

**Note: ** Be sure to set up your project for actions deployed pages.

For basic usage, create .github/workflows/deploy.yaml with the following to build on push.

on:
  push:
    branches:
      - "main" # change to the branch you wish to deploy from

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - id: build-publish
      uses: bitovi/[email protected]
      with:
        path: build # change to your build folder

Set up your project for Actions deployed Pages

  • In the project repo in GitHub, go to Settings > Pages.
  • For the source, select GitHub Actions
  • No further configuration is needed.

For the source, select GitHub Actions

Note: Your Repository must be set to public for GitHub Pages to serve content.

Inputs

The following inputs can be used as step.with keys

Name Type Description
checkout T/F Set to false if the code is already checked out (Default is true) (Optional)
path String Path of output files, Default is dist/storybook (Optional)
install_command String 'Specifies the command to run the installation. Default is npm ci. (Optional)
build_command String Specifies the command to run after the install_command for the build, Default is npm run build-storybook (Optional)

Customizing

Repository Environments

To surface published url to the root of the repo via a GitHub Environment, add the following to your workflow:

# ...etc
jobs:
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.build-publish.outputs.page_url }}
    # ...etc

Note: This is helpful when you have a custom domain

Full example with environment and yarn usage
on:
  push:
    branches:
      - "main" # change to the branch you wish to deploy from

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.build-publish.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
    - id: build-publish
      uses: bitovi/[email protected]
      with:
        path: build # change to your build folder
        install_command: yarn install
        build_command: yarn run build-storybook

External Blog Posts

Contributing

We would love for you to contribute to bitovi/github-actions-storybook-to-github-pages. Issues and Pull Requests are welcome!

License

The scripts and documentation in this project are released under the MIT License.

Provided by Bitovi

Bitovi is a proud supporter of Open Source software.

We want to hear from you.

Come chat with us about open source in our Bitovi community Discord!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.