Skip to content

Update build.yml

Update build.yml #14

Workflow file for this run

name: Node Auth Application Pipeline
# Trigger the workflow
on:
push:
branches:
- '**' # Matches every branch for push events
pull_request:
branches:
- '**' # Matches every branch for pull request events
jobs:
# Step: Cache and Install Dependencies
npm:
uses: SAINIAbhishek/shared-workflows/.github/workflows/cache-install-dependencies.yml@main
with:
node-version: '20.17.0'
lock-file: 'package-lock.json'
cache-path: 'node_modules'
cache-key-prefix: 'auth'
working-directory: './'
# Step: Lint the code
lint:
needs: [npm] # Wait for dependencies to be installed before linting
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
# Restore Modules cache
- name: Restore Modules Cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-auth-${{ hashFiles('package-lock.json') }}
# Lint the server code
- name: Checking Linting
run: npm run lint
working-directory: ./
# Step: Formatting
format:
needs: [npm] # Dependencies must be installed before formatting
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
# Restore Modules cache
- name: Restore Modules Cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-auth-${{ hashFiles('package-lock.json') }}
# Format the code with Prettier
- name: Checking Formatting with Prettier
run: npm run prettier
working-directory: ./
# Step: Security audit
dependencies-check:
needs: [npm]
uses: SAINIAbhishek/shared-workflows/.github/workflows/security-audit.yml@main
with:
node-version: '20.17.0'
lock-file: 'package-lock.json'
cache-path: 'node_modules'
cache-key-prefix: 'auth'
working-directory: './'
# Step: Build the project
dev:
needs: [lint, format, dependencies-check]
uses: ./.github/workflows/build.yml