-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (52 loc) · 1.62 KB
/
preview.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
name: Preview
on:
push:
branches: ['main']
pull_request:
branches: ['main']
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'ci-release-v') }}
outputs:
# https://www.chromatic.com/docs/github-actions#outputs
storybookUrl: ${{ steps.publish.outputs.storybookUrl }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 100
- name: Setup
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install
uses: ./.github/actions/install
- name: Publish
id: publish
uses: chromaui/action@v11
with:
buildScriptName: 'build:storybook'
externals: src/assets/**
onlyChanged: true
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
skip: 'dependabot/**'
token: ${{ secrets.GH_PAT }}
zip: true
update_pull_request:
name: Update Pull Request
runs-on: ubuntu-latest
needs: publish
if: ${{ !startsWith(github.ref, 'refs/heads/ci-release-v') && github.event_name == 'pull_request'}}
steps:
- name: Update Pull Request Preview URL
uses: ivangabriele/[email protected]
with:
githubToken: ${{ secrets.GH_PAT }}
find: AUTOFILLED_PREVIEW_URL
isHtmlCommentTag: true
replace: ${{ needs.publish.outputs.storybookUrl }}