ci: detect Hugo build output; add debug listing; robust rsync deploy
All checks were successful
hugo deploy / build-and-deploy (push) Successful in 40s
All checks were successful
hugo deploy / build-and-deploy (push) Successful in 40s
This commit is contained in:
@@ -35,6 +35,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
hugo -s website -d public
|
hugo -s website -d public
|
||||||
|
|
||||||
|
- name: Show build output
|
||||||
|
run: |
|
||||||
|
echo "CWD: $(pwd)"
|
||||||
|
hugo version
|
||||||
|
hugo -s website env
|
||||||
|
echo "Listing repo root:" && ls -la
|
||||||
|
echo "Listing website:" && ls -la website || true
|
||||||
|
echo "Listing public:" && ls -la public || true
|
||||||
|
echo "Listing website/public:" && ls -la website/public || true
|
||||||
|
|
||||||
- name: Configure SSH
|
- name: Configure SSH
|
||||||
env:
|
env:
|
||||||
HUGO_DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.HUGO_DEPLOY_SSH_PRIVATE_KEY }}
|
HUGO_DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.HUGO_DEPLOY_SSH_PRIVATE_KEY }}
|
||||||
@@ -42,8 +52,24 @@ jobs:
|
|||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "$HUGO_DEPLOY_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
echo "$HUGO_DEPLOY_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
|
||||||
- name: Deploy to server
|
- name: Deploy to server
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=no hugo-deploy@10.20.20.102 "mkdir -p /opt/containers/website/content"
|
set -e
|
||||||
rsync -avz --delete -e "ssh -o StrictHostKeyChecking=no" public/ hugo-deploy@10.20.20.102:/opt/containers/website/content/
|
# detect source directory with built site
|
||||||
|
if [ -d public ] && [ "$(ls -A public 2>/dev/null)" ]; then
|
||||||
|
SRC=public
|
||||||
|
elif [ -d website/public ] && [ "$(ls -A website/public 2>/dev/null)" ]; then
|
||||||
|
SRC=website/public
|
||||||
|
else
|
||||||
|
echo "ERROR: no build output found in public/ or website/public/"
|
||||||
|
ls -la
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Deploying from $SRC"
|
||||||
|
|
||||||
|
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null hugo-deploy@10.20.20.102 "mkdir -p /opt/containers/website/content && rm -rf /opt/containers/website/content/*"
|
||||||
|
|
||||||
|
rsync -avz --delete -e "ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" "$SRC"/ hugo-deploy@10.20.20.102:/opt/containers/website/content/
|
||||||
|
|||||||
Reference in New Issue
Block a user