+22
-12
@@ -4,36 +4,46 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
container:
|
||||
image: klakegg/hugo:ext-alpine
|
||||
|
||||
# We don't use 'container:' at the top level to avoid entrypoint issues
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true # Hugo sites often have theme submodules
|
||||
fetch-depth: 0 # Hugo needs history for .Lastmod
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: 'latest'
|
||||
extended: true
|
||||
|
||||
- name: Hugo Build
|
||||
run: hugo
|
||||
|
||||
# --- ADD THIS STEP ---
|
||||
- name: Install Deployment Tools
|
||||
run: hugo --minify
|
||||
|
||||
- name: Install SSH and Rsync
|
||||
run: |
|
||||
apk add --no-cache rsync openssh-client
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y rsync openssh-client
|
||||
|
||||
- name: SSH vorbereiten
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
|
||||
echo "${{ secrets.KNOWN_HOSTS }}" > ~/.ssh/known_hosts
|
||||
chmod 644 ~/.ssh/known_hosts
|
||||
# Scan the host key to avoid interactive prompts
|
||||
ssh-keyscan -H webserver.hahmann-trier.local >> ~/.ssh/known_hosts
|
||||
# If ssh-keyscan fails because of your local network,
|
||||
# ensure secrets.KNOWN_HOSTS is correctly set instead.
|
||||
|
||||
- name: Deploy via rsync
|
||||
run: |
|
||||
rsync -avz --delete \
|
||||
-e "ssh -o StrictHostKeyChecking=accept-new" \
|
||||
public/ \
|
||||
gitea-runner@webserver.hahmann-trier.local:/var/www/www-deepwatersurvival-de
|
||||
Reference in New Issue
Block a user