Files
purplebored.pl/.gitea/workflows/deploy.yml
Alek Nikovich ea702c6eed
Some checks failed
Deploy Website / deploy (push) Failing after 3s
If this not work I give up for today
2025-10-30 22:18:12 +00:00

67 lines
2.3 KiB
YAML

name: Deploy Website
on:
push:
branches:
- rewrite-static
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Debug secrets presence
run: |
echo "🧩 Checking secrets availability..."
for s in DEPLOY_KEY DEPLOY_HOST DEPLOY_USER DEPLOY_PATH DEPLOY_PORT; do
if [ -z "${!s}" ]; then
echo "❌ Secret $s is empty or undefined!"
else
echo "✅ $s present (length: ${#s})"
fi
done
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
- name: Set up SSH key (diagnostic)
run: |
set -euxo pipefail
echo "🏗️ Setting up SSH environment..."
mkdir -p ~/.ssh || (echo "❌ Could not create ~/.ssh" && exit 1)
chmod 700 ~/.ssh
echo "📁 Listing home directory..."
ls -al ~
echo "🔑 Writing private key to ~/.ssh/id_rsa"
echo "${DEPLOY_KEY}" | head -n 5 || echo "⚠️ DEPLOY_KEY variable empty or truncated"
printf "%s" "${DEPLOY_KEY}" > ~/.ssh/id_rsa || (echo "❌ Failed writing key file" && exit 1)
chmod 600 ~/.ssh/id_rsa
echo "📡 Adding ${DEPLOY_HOST}:${DEPLOY_PORT:-22} to known_hosts"
ssh-keyscan -p "${DEPLOY_PORT:-22}" -H "${DEPLOY_HOST}" >> ~/.ssh/known_hosts 2>/dev/null || echo "⚠️ ssh-keyscan warning (ignored)"
echo "✅ SSH setup complete!"
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
- name: Deploy website via rsync
run: |
echo "🚀 Deploying site..."
rsync -avz -e "ssh -p ${DEPLOY_PORT:-22}" --delete ./ \
${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}
echo "✅ Deployment complete!"
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}