Skip to content

lint fix

lint fix #3

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]
jobs:
build-test-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: npm install
- name: Run ESLint
run: npm run lint
- name: Run Tests
run: npm test
- name: Dependency Audit
run: npm audit --audit-level=high
- name: Build Docker Image
run: docker build -t myapp:${{ github.sha }} .
- name: Trivy Scan
uses: aquasecurity/trivy-action@master
with:
image-ref: myapp:${{ github.sha }}
- name: Push to GHCR
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker tag myapp:${{ github.sha }} ghcr.io/${{ github.repository }}/myapp:${{ github.sha }}
docker push ghcr.io/${{ github.repository }}/myapp:${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs: build-test-scan
steps:
- name: Deploy to Staging
if: github.ref == 'refs/heads/develop'
run: echo "🚀 Deploying from Docker image to staging..."
- name: Deploy to Production
if: github.ref == 'refs/heads/main'
run: echo "🚀 Deploying from Docker image to production..."