-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (61 loc) · 2.41 KB
/
storybook.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
name: Storybook
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
# New commits cancel previous builds only on pull requests. This is because `github.head_ref`` is only set on pull requests and `github.sha`` is unique for each commit.
group: storybook-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
generate-storybook:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up deploy key
run: |
mkdir -p ~/.ssh
echo "$STORYBOOK_DEPLOY_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
md5sum ~/.ssh/id_ed25519
ls -la ~/.ssh
env:
STORYBOOK_DEPLOY_KEY: ${{ secrets.STORYBOOK_DEPLOY_KEY }}
if: ${{ github.ref == 'refs/heads/master' }}
- name: Check out storybook repository
run: git clone --branch gh-pages git@github.com:rage/secret-project-storybook.git ./storybook/storybook-static-repo
env:
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes"
if: ${{ github.ref == 'refs/heads/master' }}
- name: npm ci for the repo root
run: npm ci
- name: npm ci for the storybook
run: npm ci
working-directory: ./storybook
- name: npm run build-storybook
run: npm run build-storybook -- --quiet
working-directory: ./storybook
- name: Remove old files from repo
run: rm -rf ./storybook/storybook-static-repo/*
if: ${{ github.ref == 'refs/heads/master' }}
- name: Copy new files to repo
run: cp -r ./storybook/storybook-static/* ./storybook/storybook-static-repo/
if: ${{ github.ref == 'refs/heads/master' }}
- name: Commit files
run: |
git config --local user.email "bot@example.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "Update: $GITHUB_SHA" --allow-empty
working-directory: ./storybook/storybook-static-repo
if: ${{ github.ref == 'refs/heads/master' }}
- name: Push changes
run: git push
env:
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes"
working-directory: ./storybook/storybook-static-repo
if: ${{ github.ref == 'refs/heads/master' }}