diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 00000000..9d8a8337 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,53 @@ +name: Remote Build and Deploy +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + # 1. Debugging stap: Deze stap onthult direct of de secret door Gitea wordt doorgegeven. + - name: Debug Secret + run: | + if [ -z "${{ secrets.VPS_HOST }}" ]; then + echo "FOUT: VPS_HOST secret is leeg of niet beschikbaar!" + exit 1 + else + echo "VPS_HOST is succesvol geladen." + fi + + # 2. De Deployment stap + - name: Deploying via SSH connection to VPS Host + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.VPS_HOST }} + username: "root" + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + script: | + set -e + echo "--- Starting EPIC WEB CONTROL Deployment ---" + + cd /var/www/atom-nexst/ + + # Update de code + git fetch origin --prune + git reset --hard origin/main + + # Cleanup + if [ -d "directory-name" ]; then rm -rf directory-name; fi + + # Installeer en bouw + # Gebruik het volledige pad voor pnpm (controleer dit met 'which pnpm' op je server) + /usr/local/bin/pnpm install --frozen-lockfile + /usr/local/bin/pnpm db:migrate + /usr/local/bin/pnpm prisma generate + /usr/local/bin/pnpm build + + # Restart + sudo systemctl restart atom-nexst.service + + echo "--- EPIC WEB CONTROL Deployment Completed Successfully ---" + \ No newline at end of file