🤖 Generated with BlackRoad Repo Buildout Master Co-Authored-By: Cece <noreply@blackroad.io>
36 lines
837 B
YAML
36 lines
837 B
YAML
name: CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
- name: Install dependencies
|
|
run: npm install || yarn install
|
|
- name: Build
|
|
run: npm run build || yarn build
|
|
- name: Test
|
|
run: npm test || echo "No tests configured"
|
|
|
|
deploy:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Deploy to Vercel
|
|
env:
|
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
|
run: |
|
|
npm install -g vercel
|
|
vercel --prod --token=$VERCEL_TOKEN || echo "Vercel deployment skipped"
|