Skip to content

Merge pull request #2 from ckekula/main #19

Merge pull request #2 from ckekula/main

Merge pull request #2 from ckekula/main #19

Workflow file for this run

name: CI/CD Frontend
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
- feature/*
- release/*
- hotfix/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.19.1"
- name: Install dependencies
run: |
cd frontend
npm install
- name: Run lint
run: |
cd frontend
npm run lint
- name: Run tests
run: |
cd frontend
npm test
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/frontend:latest -f frontend/Dockerfile ./frontend
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/frontend:latest
- name: Deploy to Vercel
if: github.ref == 'refs/heads/main'
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
npm install -g vercel
cd frontend
vercel --prod