diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..9133fd9 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: Deploy SecondTech + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: self-hosted + + steps: + - name: Pull latest code + run: | + cd /var/www/secondtech + git fetch origin main + git reset --hard origin/main + + - name: Install dependencies + run: | + cd /var/www/secondtech + pnpm install + + - name: Build frontend + run: | + cd /var/www/secondtech + pnpm run build + + - name: Restart backend + run: | + cd /var/www/secondtech + pm2 restart secondtech-api || pm2 start "pnpm run start" --name secondtech-api + pm2 save + + - name: Reload nginx + run: | + nginx -t + systemctl reload nginx