2023-06-01 12:20:05 +03:00
|
|
|
name: 'CI Chromatic'
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-06-27 18:55:07 +03:00
|
|
|
branches:
|
|
|
|
- main
|
2023-08-01 04:23:39 +03:00
|
|
|
pull_request_target:
|
|
|
|
types: [labeled]
|
2023-06-01 12:20:05 +03:00
|
|
|
jobs:
|
|
|
|
chromatic-deployment:
|
2023-08-01 04:23:39 +03:00
|
|
|
if: ${{ contains(github.event.*.labels.*.name, 'run-chromatic') }} || github.event_name == 'push' }}
|
2023-06-01 12:20:05 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2023-08-01 00:36:04 +03:00
|
|
|
REACT_APP_SERVER_BASE_URL: http://127.0.0.1:3000
|
2023-06-01 12:20:05 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-07-05 10:24:46 +03:00
|
|
|
if: github.event_name == 'push'
|
2023-06-01 12:20:05 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-07-05 01:04:05 +03:00
|
|
|
ref: ${{ github.head_ref || github.ref_name }}
|
2023-07-05 10:24:46 +03:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
if: github.event_name == 'pull_request_target'
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: "refs/pull/${{ github.event.number }}/merge"
|
2023-06-01 12:20:05 +03:00
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: "18"
|
|
|
|
- name: Front / Write .env
|
|
|
|
run: |
|
|
|
|
cd front
|
|
|
|
touch .env
|
2023-08-01 00:36:04 +03:00
|
|
|
echo "REACT_APP_SERVER_BASE_URL: $REACT_APP_SERVER_BASE_URL" >> .env
|
2023-06-01 12:20:05 +03:00
|
|
|
- name: Front / Install Dependencies
|
2023-06-14 17:56:29 +03:00
|
|
|
run: cd front && yarn
|
2023-06-01 12:20:05 +03:00
|
|
|
- name: Publish to Chromatic
|
|
|
|
uses: chromaui/action@v1
|
|
|
|
with:
|
|
|
|
workingDir: ./front
|
|
|
|
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
2023-06-13 19:45:18 +03:00
|
|
|
onlyChanged: true
|
2023-07-07 04:53:26 +03:00
|
|
|
buildScriptName: storybook:build
|
2023-06-01 12:20:05 +03:00
|
|
|
|