This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (93 loc) · 3.8 KB
/
publish-storybooks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# 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:
workflow_run:
workflows: ["Release"]
types:
- completed
workflow_dispatch:
inputs:
monday-ui-react-core:
required: false
type: boolean
default: false
description: "monday-ui-react-core"
monday-ui-style:
required: false
type: boolean
default: false
description: "monday-ui-style"
vibe-storybook-components:
required: false
type: boolean
default: false
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: "Build failed - exit"
if: success() != true
run: |
echo "::error::build_step failed - publish-storybooks cancelled"
exit 1
- name: Set up git credentials
run: |
git config --global user.name 'ci'
git config --global user.email 'deploy@monday.com'
- name: Picking what to deploy
run: |
if [ ${{ github.event_name == 'workflow_dispatch' }} ]; then
echo "ANY_PACKAGE_SELECTED=$(${{ github.event.inputs.monday-ui-react-core }} || ${{ github.event.inputs.monday-ui-style }} || ${{ github.event.inputs.vibe-storybook-components }})" >> $GITHUB_ENV
else
echo "ANY_PACKAGE_SELECTED=false" >> $GITHUB_ENV
fi
if [ ${{ env.ANY_PACKAGE_SELECTED == 'false' }} ]; then
echo "No package selected, deploying all..."
else
echo "Deploying only selected packages..."
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 }}"
fi
- name: Push monday-ui-react-core Storybook to Github Pages
if: ${{ env.ANY_PACKAGE_SELECTED == '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.ANY_PACKAGE_SELECTED == '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.ANY_PACKAGE_SELECTED == '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 }}