Skip to content

Update CI pipeline to include env, cache, and type check #2

Update CI pipeline to include env, cache, and type check

Update CI pipeline to include env, cache, and type check #2

Workflow file for this run

name: Frontend CI
on:
push:
branches: [ ci-cd-demo ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }}
NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Type check
run: npx tsc --noEmit
- name: Run build
run: npm run build
- name: Run linter
run: npm run lint