Update .gitea/workflows/deploy.yml
This commit is contained in:
@@ -12,36 +12,43 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Debug step (optional) - confirms secrets and environment
|
# Debug step (optional)
|
||||||
- name: Debug environment
|
- name: Debug environment
|
||||||
run: |
|
run: |
|
||||||
echo "Host: ${DEPLOY_HOST}"
|
echo "Host: ${DEPLOY_HOST}"
|
||||||
|
echo "User: ${DEPLOY_USER}"
|
||||||
|
echo "Port: ${DEPLOY_PORT:-22}"
|
||||||
if [ -n "${DEPLOY_KEY}" ]; then
|
if [ -n "${DEPLOY_KEY}" ]; then
|
||||||
echo "? DEPLOY_KEY is set"
|
echo "✅ DEPLOY_KEY is set"
|
||||||
else
|
else
|
||||||
echo "? DEPLOY_KEY is missing!"
|
echo "❌ DEPLOY_KEY is missing!"
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||||
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
||||||
|
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
||||||
|
|
||||||
# Set up SSH key safely
|
# Set up SSH key safely
|
||||||
- name: Set up SSH key
|
- name: Set up SSH key
|
||||||
run: |
|
run: |
|
||||||
|
set -e
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
printf "%s" "${DEPLOY_KEY}" > ~/.ssh/id_rsa
|
printf "%s" "${DEPLOY_KEY}" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
ssh-keyscan -H "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
|
ssh-keyscan -p "${DEPLOY_PORT:-22}" -H "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
|
||||||
env:
|
env:
|
||||||
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
|
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
||||||
|
|
||||||
# Deploy site files with rsync
|
# Deploy site files with rsync over custom port
|
||||||
- name: Deploy website via rsync
|
- name: Deploy website via rsync
|
||||||
run: |
|
run: |
|
||||||
echo "?? Deploying files to ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"
|
echo "🚀 Deploying files to ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH} (port ${DEPLOY_PORT:-22})"
|
||||||
rsync -avz --delete ./ ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}
|
rsync -avz -e "ssh -p ${DEPLOY_PORT:-22}" --delete ./ ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}
|
||||||
env:
|
env:
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||||
|
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
||||||
|
|||||||
Reference in New Issue
Block a user