Files
biztaghavisite/.gitea/workflows/ci-cd.yml
Ali Taghavi 27d7c43f24
Some checks failed
CI/CD Pipeline / Lint & Typecheck (push) Failing after 9s
CI/CD Pipeline / Deploy to Server (push) Has been skipped
fixed app-dir
2026-05-10 09:28:45 +03:30

52 lines
1.3 KiB
YAML

name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
lint:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Run lint
run: pnpm lint
- name: Run typecheck
run: pnpm typecheck
deploy:
name: Deploy to Server
runs-on: ubuntu-latest
needs: lint
steps:
- name: Deploy via SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SERVER_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} '
set -e
APP_DIR="/srv/nodecloud/apps/biztaghavisite"
cd "$APP_DIR"
echo "⬇️ Pulling latest code..."
git pull origin main
echo "🐳 Building Docker image..."
docker compose build
echo "🚀 Restarting container..."
docker compose up -d --force-recreate
docker image prune -f
echo "✅ Deploy complete!"
'