Skip to content

Instantly share code, notes, and snippets.

@mintothejoo
Created September 6, 2021 00:32
Show Gist options
  • Save mintothejoo/d1d87eef90dfb746d99f699a4fd1ffc9 to your computer and use it in GitHub Desktop.
Save mintothejoo/d1d87eef90dfb746d99f699a4fd1ffc9 to your computer and use it in GitHub Desktop.
# .github/workflows/chromatic.yml
# Workflow name
name: 'Chromatic'
# Run on push ONLY. Pull request has some complications.
on:
push:
paths:
- "puffin-platform/**"
# List of jobs
jobs:
chromatic-deployment:
# Operating System
runs-on: ubuntu-latest
defaults:
run:
working-directory: puffin-platform
# Job steps
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules Folder
uses: actions/cache@v2
with:
path: puffin-platform/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Publish to Chromatic
if: github.ref != 'refs/heads/master'
uses: chromaui/action@v1
with:
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
workingDir: "puffin-platform"
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
# Because we rebase and merge our PRs, we need to auto accept changes on master.
# https://www.chromatic.com/docs/github-actions#github-squashrebase-merge-and-the-main-branch
- name: Publish to Chromatic and auto accept changes
if: github.ref == 'refs/heads/master'
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
workingDir: "puffin-platform"
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: true # 👈 Option to accept all changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment