-
Notifications
You must be signed in to change notification settings - Fork 26
103 lines (88 loc) · 2.75 KB
/
sb.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
98
99
100
101
102
103
name: Build and publish storybook
# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: 'pages-${{ github.ref_name }}' # unique builds for branch/tag name
cancel-in-progress: true
jobs:
storybook:
name: Create storybook build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up backend environment
uses: maykinmedia/[email protected]
with:
apt-packages: 'libxml2 libxmlsec1 libxmlsec1-openssl gdal-bin'
python-version: '3.10'
optimize-postgres: 'no'
setup-node: 'yes'
npm-ci-flags: '--legacy-peer-deps'
- name: Build Storybook docs
run: |
python src/manage.py collectstatic --noinput
npm run build-storybook
env:
DJANGO_SETTINGS_MODULE: openforms.conf.ci
API_BASE_URL: 'http://localhost:8000'
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./storybook-static
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.event_name == 'push' # Exclude PRs
needs: storybook
steps:
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
chromatic:
name: Chromatic (interaction & visual tests)
runs-on: ubuntu-latest
needs:
- storybook
# do not run in forks
if: github.event_name == 'push' || ! github.event.pull_request.head.repo.fork
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # 👈 Required to retrieve git history
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: github-pages
path: ./storybook-static
- name: Extract artifact
run: |
tar -xvf artifact.tar
rm artifact.tar
working-directory: ./storybook-static
- name: Publish to Chromatic
uses: chromaui/action@latest
if: github.event.pull_request.draft == false || github.event.push
with:
autoAcceptChanges: master
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: ./storybook-static
onlyChanged: true