Skip to content

Commit

Permalink
test push
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKhalif8254 committed Sep 20, 2024
1 parent 0b11113 commit aa24a48
Showing 1 changed file with 47 additions and 38 deletions.
85 changes: 47 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,57 @@ name: CI

on:
push:
branches:
- '**' # Run on all branches
- '!production' # Exclude the production branch
branches: [main, production]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
environment: [production, preview]
environment: ${{ matrix.environment }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run lint

env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
DISCORD_CLIENT_SECRET: ${{ secrets.DISCORD_CLIENT_SECRET }}
GITHUB_CLIENT_ID: ${{ secrets.GITHUB_CLIENT_ID }}
GITHUB_CLIENT_SECRET: ${{ secrets.GITHUB_CLIENT_SECRET }}
TWITTER_CLIENT_ID: ${{ secrets.TWITTER_CLIENT_ID }}
TWITTER_CLIENT_SECRET: ${{ secrets.TWITTER_CLIENT_SECRET }}
SKIP_ENV_VALIDATION: true
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm test

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- name: Build
run: npm run build
env:
NODE_ENV: ${{ github.ref == 'refs/heads/production' && 'production' || 'preview' }}

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && github.ref == 'refs/heads/production'
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

# - name: Run tests
# run: npm test

- name: Build
run: npm run build
- name: Deploy to Production
run: echo "Deploying to production"
# Add your deployment steps here

0 comments on commit aa24a48

Please sign in to comment.