Skip to content

Add unit tests for LoginScreen component #2

Add unit tests for LoginScreen component

Add unit tests for LoginScreen component #2

Workflow file for this run

name: Deploy to Vercel
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
workflow_dispatch:
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
# Build and Test
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Generate Prisma Client
run: bun run db:generate
- name: Build
run: bun run build
env:
DATABASE_URL: "file:./db/chappi.db"
- name: Lint
run: bun run lint
# Deploy to Vercel Preview (PRs)
deploy-preview:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Vercel CLI
run: bun add -g vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
# Deploy to Vercel Production
deploy-production:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Vercel CLI
run: bun add -g vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Comment deployment URL
if: github.event_name == 'push'
uses: actions/github-script@v7
with:
script: |
const commit = context.sha.substring(0, 7);
const url = `https://${process.env.VERCEL_PROJECT_ID}.vercel.app`;
github.rest.repos.createCommitComment({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
body: `🚀 Deployed to production!\n\nURL: ${url}\nCommit: ${commit}`
});
# Generate PWA Icons
generate-icons:
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install sharp
run: npm install sharp --save-dev
- name: Generate PWA Icons
run: |
node scripts/generate-icons.js
- name: Commit icons
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add public/icons/
git diff --quiet && git diff --staged --quiet || git commit -m "chore: generate PWA icons [skip ci]"
git push