Merge branch 'main' of https://github.com/prasad-kadu/portfolio #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci-cd | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
name: Cache NPM Dependencies | |
with: | |
node-version: 16.15.0 | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- run: npm ci | |
- name: Install Additional Dependencies | |
run: npm install | |
- name: Lint Website | |
run: npx eslint --fix 'src/**/*.js' | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
name: Cache NPM Dependencies | |
with: | |
node-version: 16.15.0 | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- run: npm ci | |
- name: Install Additional Dependencies | |
run: npm install | |
- name: Test Website | |
run: npm test | |
staging: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
name: Cache NPM Dependencies | |
with: | |
node-version: 16.15.0 | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- run: npm ci | |
- name: Install Additional Dependencies | |
run: npm install | |
- name: Build site | |
run: npm run build | |
- name: Deploy | |
uses: netlify/actions/cli@master | |
with: | |
args: deploy --dir=build | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
deploy: | |
needs: [lint, staging] | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
name: Cache NPM Dependencies | |
with: | |
node-version: 16.15.0 | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- run: npm ci | |
- name: Install Additional Dependencies | |
run: npm install | |
- name: Build site | |
run: npm run build | |
- name: Deploy | |
uses: netlify/actions/cli@master | |
with: | |
args: deploy --dir=build --prod | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |