Merge pull request #161 from lunit-io/ds-171-ci #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/chromatic.yml | |
# Workflow name | |
name: "Chromatic Deployment - Logo" | |
# Event for the workflow | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- ".github/workflows/logo-chromatic.yml" | |
- "packages/design-system-logo/**" | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- ".github/workflows/logo-chromatic.yml" | |
- "packages/design-system-logo/**" | |
# List of jobs | |
jobs: | |
chromatic-deployment: | |
# Operating System | |
runs-on: ubuntu-latest | |
# Job steps | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required to retrieve git history | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
cache: "npm" | |
- uses: nrwl/nx-set-shas@v4 | |
- name: Nx Cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/nx | |
key: ${{ github.repository }}-nx-${{ env.NX_BASE }} | |
restore-keys: | | |
${{ github.repository }}-nx- | |
- name: Install dependencies | |
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g., yarn, npm, pnpm | |
run: npm ci | |
- name: Build design-system-logo package | |
run: npm run build:design-system-logo | |
# 👇 Adds Chromatic as a step in the workflow | |
- id: chromatic | |
name: Publish design-system-logo to Chromatic | |
uses: chromaui/action@latest | |
# Chromatic GitHub Action options | |
with: | |
# 👇 Chromatic projectToken, refer to the manage page to obtain it. | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_LOGO }} | |
buildScriptName: build-storybook:design-system-logo | |
- name: Comment preview link | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: "Logo Storybook: ${{ steps.chromatic.outputs.storybookUrl }}" | |
comment_tag: "LOGO_PREVIEW_LINK_COMMENT" |