Skip to content

Updated to V2

Updated to V2 #18

Workflow file for this run

name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
NODE_VERSION: '20'
POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run type check
run: npx tsc --noEmit
- name: Run linting
run: npx eslint . --ext .ts,.tsx --max-warnings=0
- name: Run tests
run: npm test
build:
name: Build
needs: test
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST: ${{ secrets.POSTHOG_HOST || 'https://app.posthog.com' }}
deploy:
name: Deploy
needs: build
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST: ${{ secrets.POSTHOG_HOST || 'https://app.posthog.com' }}
# Add your deployment steps here
# Example for Vercel:
# - name: Deploy to Vercel
# uses: amondnet/vercel-action@v20
# with:
# vercel-token: ${{ secrets.VERCEL_TOKEN }}
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
# working-directory: ./
# vercel-args: '--prod'