-
Notifications
You must be signed in to change notification settings - Fork 538
60 lines (57 loc) · 2.07 KB
/
deploy_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
57
58
59
60
name: Deploy
on:
pull_request:
permissions:
contents: read
pages: write
id-token: write
deployments: write
statuses: write
checks: write
jobs:
deploy-preview:
# if the source repository for pull request is a fork, we don't want to run this workflow,
# we run deploy_preview_forks.yml which uses pull_request_target instead.
# see https://github.com/primer/react/pull/2207 for details
if: ${{ github.event.pull_request.head.repo.full_name == 'primer/react' }} # source repository for pull_request
name: Preview
uses: primer/.github/.github/workflows/deploy_preview.yml@0cec9b9914f358846163f2428663b58da41028c9
permissions:
contents: read
pages: write
id-token: write
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
with:
node_version: 18
install: npm ci && cd docs && npm ci --legacy-peer-deps && cd ..
build: npm run build:docs:preview
output_dir: docs/public
deploy-storybook:
if: ${{ github.repository == 'primer/react' }}
name: Preview Storybook
runs-on: ubuntu-latest
needs: deploy-preview
steps:
- uses: chrnorm/deployment-action@v2.0.5
name: Create GitHub deployment for storybook
id: storybook
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: storybook-preview-${{ github.event.number }}
environment_url: '${{ needs.deploy-preview.outputs.deployment_url }}/storybook'
- name: Update storybook deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}/storybook'
state: 'success'
deployment-id: ${{ steps.storybook.outputs.deployment_id }}
- name: Update storybook deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
state: 'failure'
deployment-id: ${{ steps.storybook.outputs.deployment_id }}