Skip to content

Core package (#188) #231

Core package (#188)

Core package (#188) #231

---
name: On Push to Master
on:
push:
branches:
- "master"
workflow_dispatch:
jobs:
unit:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
with:
run_install: false
- name: Get pnpm store cache directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: pnpm Install
run: pnpm install
- name: Run Unit Tests
run: pnpm test
changesets_version:
needs: [unit]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
outputs:
published: ${{ steps.published.outputs.published }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.DEPLOY_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
with:
run_install: false
- name: Get pnpm store cache directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: pnpm Install
run: pnpm install
- name: Build
run: pnpm build
- name: Release
id: release
uses: changesets/action@v1
with:
publish: pnpm run publish
version: pnpm run version
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update output
id: published
if: steps.release.outputs.published == 'true'
run: echo "published=true" >> "$GITHUB_OUTPUT"
deploy_storybook:
needs: changesets_version
if: needs.changesets_version.outputs.published == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
with:
run_install: false
- name: Get pnpm store cache directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: pnpm Install
run: pnpm install
- name: Deploy
run: pnpm storybook:deploy
env:
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
update_chromatic_baseline:
needs: changesets_version
if: needs.changesets_version.outputs.published == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.DEPLOY_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
with:
run_install: false
- name: Get pnpm store cache directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: pnpm Install
run: pnpm install
- name: Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: packages/react
onlyChanged: true
exitZeroOnChanges: true
exitOnceUploaded: true
autoAcceptChanges: true