diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..3fc6a53a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: Runs Preetier Check, Lint Check, Build Check +# first runs prettier and lint checks then builds the code. +on: [pull_request, push] + +jobs: + build-project: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + + - name: Install Dependencies + run: npm install + + - name: Code Formatting Check #Runs Prettier Script + run: npm run prettier + + - name: Linting Check #Runs ESLint Script + run: npm run lint + + - name: Build #Build the project + run: npm run build + + - name: Check Build Status + run: | + if [ $? -eq 0 ]; then + echo "Build successful!" + else + echo "Build failed!" + exit 1 + fi diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml new file mode 100644 index 00000000..6a343211 --- /dev/null +++ b/.github/workflows/chromatic.yml @@ -0,0 +1,30 @@ +# Workflow name +name: "Deploy StoryBook on Chromatic" + +# Event for the workflow +on: [pull_request,push] + +# List of jobs +jobs: + chromatic-deployment: + # Operating System + runs-on: ubuntu-latest + # Job steps + steps: + - name: Checkout Repository + uses: actions/checkout@v1 + + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + + - name: Install dependencies + run: npm install + # 👇 Adds Chromatic as a step in the workflow + - name: Publish to Chromatic + uses: chromaui/action@v1 + # Chromatic GitHub Action options + with: + # 👇 Chromatic projectToken, refer to the manage page to obtain it. + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index 74b8d692..2bc92777 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "lint": "next lint", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", - "chromatic": "npx chromatic --project-token=chpt_1a0522d85a68f99" + "chromatic": "npx chromatic --project-token=chpt_1a0522d85a68f99", + "prettier" : "npx prettier . --check" }, "dependencies": { "autoprefixer": "10.4.16",