Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

build: Add build-storybook to root package.json and to cacheableOpera… #3

build: Add build-storybook to root package.json and to cacheableOpera…

build: Add build-storybook to root package.json and to cacheableOpera… #3

# Publish Storybooks to GitHub Pages - on push to master or workflow_dispatch with package selection - builds and pushes storybook-static folders to gh-pages branches
name: Publish Storybooks
on:
push:
branches:
- master # maybe should also avoid release commits - from "ci" user
workflow_dispatch:
inputs:
monday-ui-react-core:
required: false
type: boolean
description: "monday-ui-react-core"
monday-ui-style:
required: false
type: boolean
description: "monday-ui-style"
vibe-storybook-components:
required: false
type: boolean
description: "vibe-storybook-components"
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Build & deploy Storybooks to GitHub Pages
id: build_step
run: |
yarn install --frozen-lockfile
yarn build
yarn build-storybook
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set up git credentials
run: |
git config --global user.name 'ci'
git config --global user.email 'deploy@monday.com'
- name: "Build failed - exit"
if: success() != true
run: |
echo "::error::build_step failed - publish-storybooks cancelled"
exit 1
- name: Set variable
run: |
echo "Should deploy monday-ui-react-core Storybook: ${{ github.event.inputs.monday-ui-react-core }}"
echo "Should deploy monday-ui-style Storybook: ${{ github.event.inputs.monday-ui-style }}"
echo "Should deploy vibe-storybook-components Storybook: ${{ github.event.inputs.vibe-storybook-components }}"
echo "USER_INPUT=$(${{ github.event.inputs.monday-ui-react-core }} || ${{ github.event.inputs.monday-ui-style }} || ${{ github.event.inputs.vibe-storybook-components }})" >> $GITHUB_ENV
echo "USER_INPUT: ${{ env.USER_INPUT }}"
- name: Push monday-ui-react-core Storybook to Github Pages
if: ${{ env.USER_INPUT == 'false' }} || ${{ github.event.inputs.monday-ui-react-core == 'true' }}
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
folder: "packages/monday-ui-react-core/storybook-static"
branch: "gh-pages"
target-folder: "monday-ui-react-core"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push monday-ui-style Storybook to Github Pages
if: ${{ env.USER_INPUT == 'false' }} || ${{ github.event.inputs.monday-ui-style == 'true' }}
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
folder: "packages/monday-ui-style/storybook-static"
branch: "gh-pages"
target-folder: "monday-ui-style"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push vibe-storybook-components Storybook to Github Pages
if: ${{ env.USER_INPUT == 'false' }} || ${{ github.event.inputs.vibe-storybook-components == 'true' }}
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
folder: "packages/vibe-storybook-components/storybook-static"
branch: "gh-pages"
target-folder: "vibe-storybook-components"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}