again... fixing deployment actions
Some checks failed
Deploy / Check & Build (push) Successful in 1m28s
Deploy / Deploy to Production (push) Has been cancelled

This commit is contained in:
RaineAllDay
2026-03-18 04:55:29 -06:00
parent 7ff80e3a08
commit f28b8f06c6
2 changed files with 25 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
# .gitea/workflows/deploy.yml
# Triggered on push to main.
# Runs CI checks first, then deploys to production.
# Uses no external actions — all steps are plain shell commands.
#
# Required Gitea secrets (Settings → Secrets → Actions):
# DEPLOY_HOST — droplet IP or hostname
@@ -23,7 +23,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
git checkout ${{ gitea.sha }}
- name: Verify Node.js
run: node --version && npm --version
@@ -55,24 +57,20 @@ jobs:
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
set -e
APP_DIR=/opt/etc-prs/app
APP_USER=prs
echo "▸ Pulling latest code…"
cd "$APP_DIR" && git pull
echo "▸ Installing dependencies…"
npm install --quiet
echo "▸ Building…"
npm run build
echo "▸ Fixing ownership…"
chown -R "${APP_USER}:${APP_USER}" "$APP_DIR"
echo "▸ Reloading PM2…"
pm2 reload etc-prs
echo "✓ Deploy complete"
run: |
# Write the private key to a temp file
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
# Disable strict host checking so first connection doesn't hang
echo "StrictHostKeyChecking no" >> ~/.ssh/config
# SSH in and run the redeploy script
ssh -i ~/.ssh/deploy_key \
-p ${{ secrets.DEPLOY_PORT }} \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"bash /opt/etc-prs/app/scripts/redeploy.sh"
# Clean up
rm -f ~/.ssh/deploy_key