-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (53 loc) · 1.89 KB
/
deploy-github-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
52
53
54
55
56
57
58
59
name: Publish Storybook to GitHub Pages
on:
push:
branches:
- 'main'
# WARNING: This allows storybook-branch-switcher CLI to run `npm run ${arbitrary_script}`
# BUT the worst it can do is:
# - force changes to our GitHub Pages website,
# - force commit status updates,
# unless the permissions key below is changed.
pull_request:
types: [opened, synchronize, reopened]
# Be careful about changing these, due to pull_request_target trigger.
permissions:
contents: read
pages: write
id-token: write
statuses: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
# See: https://github.com/bitovi/github-actions-storybook-to-github-pages
- uses: bitovi/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
build_command: "npx sb-branch-switcher --config .storybook/.branches.json"
path: dist/storybook-bundle
# Done manually so we can checkout submodule
checkout: false
- name: Fail if PR portion of build failed
if: ${{ github.event_name == 'pull_request' }}
shell: bash
env:
#DIRECTORY: dist/storybook-bundle/PR-${{ github.event.number }}
DIRECTORY: dist/storybook-bundle/PR-19
run: |
if [ ! -d "$DIRECTORY" ]; then
echo Pull Request build directory "$DIRECTORY does not exist."
exit 1
fi
# See: https://github.com/ouzi-dev/commit-status-updater/pull/533
- uses: patcon/commit-status-updater@patch-1
if: ${{ github.event_name == 'pull_request_target' }}
with:
status: "success"
url: "https://civictechto.github.io/polis-storybook/PR-${{ github.event.number }}/"
name: "Storybook"
description: "This branch now available."