frontend.sensualmoment.de/.github/workflows/deploy-production.yml

50 lines
1.6 KiB
YAML

name: Deploy to Production
on:
push:
branches: [main]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main'
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.PROD_SSH_HOST }}
port: ${{ secrets.PROD_SSH_PORT }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
command_timeout: 15m
script_stop: true
script: |
echo "=== Deploying sensualmoment.de to production ==="
su - sensualmoment_admin -s /bin/bash -c '
set -e
export PATH=/opt/plesk/node/22/bin:/usr/local/bin:/usr/bin:/bin
cd /var/www/vhosts/sensualmoment.de/httpdocs
echo "--- Git fetch + reset ---"
git fetch origin main
git reset --hard origin/main
echo "--- Update payload-contracts ---"
npm update @c2s/payload-contracts
echo "--- Install dependencies ---"
npm install --legacy-peer-deps --production=false
echo "--- Build ---"
npm run build
echo "--- Restart Passenger ---"
mkdir -p tmp
touch tmp/restart.txt
date -u +%Y-%m-%dT%H:%M:%SZ > .last-successful-deploy
'
echo "=== Deploy complete ==="