Skip to content

Commit

Permalink
Added workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushtiwari110 committed Sep 28, 2023
1 parent 7247240 commit 09da94b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 09da94b

Please sign in to comment.