49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
name: Deploy Website
|
|
run-name: Deploying static site by ${{ github.actor }}
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy via SSH
|
|
uses: appleboy/ssh-action@v1.0.0
|
|
with:
|
|
host: ${{ secrets.SSH_HOST }}
|
|
username: ${{ secrets.SSH_USER }}
|
|
key: ${{ secrets.SSH_KEY }}
|
|
script: |
|
|
set -e
|
|
DEPLOY_DIR="/opt/adiuvai-waitlist/website"
|
|
REPO_URL="https://git.muticolturano.com/${{ gitea.repository }}.git"
|
|
|
|
# Clone latest into temp dir
|
|
cd /tmp && rm -rf website-deploy
|
|
git clone --depth 1 "${REPO_URL}" website-deploy
|
|
|
|
# Sync files (clear contents, not the directory itself)
|
|
mkdir -p "$DEPLOY_DIR"
|
|
find "$DEPLOY_DIR" -mindepth 1 -delete
|
|
cp -r /tmp/website-deploy/index.html \
|
|
/tmp/website-deploy/privacy.html \
|
|
/tmp/website-deploy/terms.html \
|
|
/tmp/website-deploy/i18n.js \
|
|
/tmp/website-deploy/robots.txt \
|
|
/tmp/website-deploy/sitemap.xml \
|
|
"$DEPLOY_DIR/"
|
|
[ -d /tmp/website-deploy/assets ] && cp -r /tmp/website-deploy/assets "$DEPLOY_DIR/"
|
|
|
|
# Cleanup
|
|
rm -rf /tmp/website-deploy
|
|
|
|
# Verify
|
|
if [ -f "$DEPLOY_DIR/index.html" ]; then
|
|
echo "✅ Website deployed"
|
|
else
|
|
echo "❌ index.html not found"
|
|
exit 1
|
|
fi |