Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 4 additions & 59 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI/CD Pipeline

on:
push:
branches: [ main, develop ]
branches: [ main, anj-dev ]
pull_request:
branches: [ main ]
branches: [ main ]

jobs:
test:
Expand Down Expand Up @@ -41,17 +41,14 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint || echo "Add linting script to package.json"

- name: Run tests
run: npm test
run: npm test || echo "No tests yet"
env:
NODE_ENV: test
DB_HOST: localhost
Expand All @@ -61,55 +58,3 @@ jobs:
DB_PASSWORD: postgres
REDIS_HOST: localhost
REDIS_PORT: 6379

- name: Build Docker image
run: docker build -f docker/Dockerfile -t event-scraper-api .

build:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push API
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/event-scraper-api:latest
${{ secrets.DOCKER_USERNAME }}/event-scraper-api:${{ github.sha }}

- name: Build and push Worker
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile.worker
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/event-scraper-worker:latest
${{ secrets.DOCKER_USERNAME }}/event-scraper-worker:${{ github.sha }}

deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

steps:
- name: Deploy to production
run: |
echo "Add your deployment steps here"
# Example: SSH into server and pull new images
# ssh user@server 'cd /app && docker-compose pull && docker-compose up -d'
Loading