refactor: update deployment process to use SSH and clone repository
All checks were successful
Deploy Website / deploy (push) Successful in 3s
All checks were successful
Deploy Website / deploy (push) Successful in 3s
This commit is contained in:
@@ -10,27 +10,35 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy static files via SCP
|
||||
uses: appleboy/scp-action@v0.1.7
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USER }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
source: "index.html,privacy.html,terms.html,assets/*"
|
||||
target: "/opt/adiuvai-waitlist/website/"
|
||||
rm: true
|
||||
|
||||
- name: Verify deployment
|
||||
- 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: |
|
||||
if [ -f /opt/adiuvai-waitlist/website/index.html ]; then
|
||||
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 \
|
||||
"$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"
|
||||
|
||||
Reference in New Issue
Block a user