45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: debian-slim
|
|
container:
|
|
image: hugomods/hugo:debian-dart-sass-node-git-0.161.1
|
|
steps:
|
|
- name: Install packages
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
run: apt-get update -qq && apt-get install -qq -y git-lfs rsync > /dev/null
|
|
|
|
- name: Checkout with LFS
|
|
uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Build Hugo site
|
|
run: hugo --minify
|
|
|
|
- name: Deploy via rsync
|
|
env:
|
|
SSH_KEY: ${{ secrets.drone_sshkey }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_KEY" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
for host in \
|
|
nginx0.chrma0.net.ipng.ch \
|
|
nginx0.chplo0.net.ipng.ch \
|
|
nginx0.chlzn0.net.ipng.ch \
|
|
nginx0.frggh0.net.ipng.ch \
|
|
nginx0.nlams0.net.ipng.ch \
|
|
nginx0.nlams1.net.ipng.ch \
|
|
nginx0.nlams2.net.ipng.ch; do
|
|
cmd="rsync -6a --delete-after -e \"ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o LogLevel=ERROR\" public/ drone@${host}:/nginx/sites/ipng.ch/"
|
|
echo "${cmd}"
|
|
eval "${cmd}"
|
|
done
|