1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 11:17:05 +03:00
css/.github/workflows/deploy_preview.yml
Katie Langerman b7fd01d5a1
Deploy Storybook on Pull-Request (#1703)
* add build storybook

* Storybook deployment status (#1704)

* attempt 1

* nested path for storybook

* create duplicate deployment

* Different environment for storybook

* Take care of failure case as well

Co-authored-by: Siddharth Kshetrapal <siddharthkp@github.com>
2021-10-25 16:45:39 -07:00

75 lines
2.4 KiB
YAML

name: Deploy
on:
push:
branches-ignore:
- 'main'
paths:
- 'src/**'
- 'docs/**'
- '.github/workflows/deploy*.yml'
- 'package.json'
jobs:
deploy-preview:
if: ${{ github.repository == 'primer/css' }}
name: Preview
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: chrnorm/deployment-action@v1.2.0
name: Create GitHub deployment
id: deployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: Preview
- uses: chrnorm/deployment-action@v1.2.0
name: Create GitHub deployment for storybook
id: storybook
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: Storybook Preview
- name: Vercel Action
uses: amondnet/vercel-action@v20
id: vercel-action
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-token: ${{ secrets.VERCEL_TOKEN_SHARED }}
github-comment: false
vercel-org-id: ${{ secrets.VERCEL_ORG_ID_SHARED }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment_url: ${{ steps.vercel-action.outputs.preview-url }}
state: "success"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update storybook deployment status (success)
if: success()
uses: chrnorm/deployment-status@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment_url: '${{ steps.vercel-action.outputs.preview-url }}/css/storybook'
state: "success"
deployment_id: ${{ steps.storybook.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update storybook deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
state: "failure"
deployment_id: ${{ steps.storybook.outputs.deployment_id }}