Skip to content

refactor: improve code formatting and readability across multiple com… #3

refactor: improve code formatting and readability across multiple com…

refactor: improve code formatting and readability across multiple com… #3

Workflow file for this run

name: Frontend CI/CD
on:
push:
branches: [main, develop]
paths:
- "client-nachweise/**"
- ".github/workflows/frontend-ci.yml"
pull_request:
branches: [main, develop]
paths:
- "client-nachweise/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: client-nachweise/package-lock.json
- name: Install dependencies
working-directory: client-nachweise
run: npm ci
- name: Run linter
working-directory: client-nachweise
run: npm run lint
- name: Build
working-directory: client-nachweise
run: npm run build
deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.VPS_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
- name: Deploy to VPS
run: |
ssh -i ~/.ssh/deploy_key ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} << 'EOF'
cd ${{ secrets.VPS_DEPLOY_PATH }}/client-nachweise
git pull origin main
npm ci
npm run build
docker-compose -f ../docker-compose.yml up -d client
EOF