diff --git a/.github/workflows/storybook-test.yml b/.github/workflows/storybook-test.yml index 08867c5..39a405c 100644 --- a/.github/workflows/storybook-test.yml +++ b/.github/workflows/storybook-test.yml @@ -12,10 +12,19 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' + - name: Cache Yarn dependencies + uses: actions/cache@v2 + with: + path: | + .yarn/cache + **/node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Install dependencies run: yarn - name: Install Playwright @@ -24,10 +33,34 @@ jobs: run: yarn storybook:build --quiet - name: Serve Storybook and run tests run: | - npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ + npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ "npx http-server storybook-static --port 6006 --silent" \ "npx wait-on http-get://127.0.0.1:6006 && yarn storybook:test" - - name: Chromatic Build - run: yarn storybook:chromatic - + chromatic: + if: secrets.CHROMATIC_PROJECT_TOKEN != '' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - name: Cache Yarn dependencies + uses: actions/cache@v2 + with: + path: | + .yarn/cache + **/node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install dependencies + run: yarn + - name: Publish to Chromatic + uses: chromaui/action@latest + with: + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + autoAcceptChanges: "main" + buildScriptName: "storybook:chromatic" + env: + CI: true