-
Notifications
You must be signed in to change notification settings - Fork 5
51 lines (40 loc) · 1.34 KB
/
gh-pages.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
name: GitHub Pages
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build GitHub pages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Install dependencies
run: npm --prefix=react-app ci
- name: 📚 Build Storybook
env:
BASE_PATH: /color-tables/storybook-static/
run: npm run build-storybook --prefix ./react-app
- name: 📚 Publish Storybook
if: github.event_name == 'push'
run: |
cp -r ./react-app/storybook-static ..
git config --local user.email "color-tables-github-action"
git config --local user.name "color-tables-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x
git rm -r --ignore-unmatch *
mv ../storybook-static .
touch .nojekyll
git add .
if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi