Skip to content

Add caddyfile on deploy workflow #46

Add caddyfile on deploy workflow

Add caddyfile on deploy workflow #46

Workflow file for this run

name: Deploy
on:
push:
branches: [ main ]
concurrency:
group: "production"
cancel-in-progress: false
jobs:
deploy:
environment:
name: production
url: "https://laniakeabooks.org/"
runs-on: ubuntu-24.04
steps:
- name: Install Zola
run: sudo snap install --edge zola
- name: Checkout
uses: actions/checkout@v4
- name: Build website
run: zola build
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/server.key
chmod 600 ~/.ssh/server.key
cat >> ~/.ssh/config << EOF
Host laniakea
HostName 65.21.187.95
User root
IdentityFile ~/.ssh/server.key
StrictHostKeyChecking no
EOF
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
- name: Sync changes
run: |
rsync -avz --progress --delete --chown=deploy:www-data public/ laniakea:/var/www/laniakea
- name: Write Caddyfile
run: |
ssh laniakea 'cat > /etc/caddy/laniakea.caddy << EOF
laniakeabooks.org {
root * /var/www/laniakea
file_server {
hide .git
}
encode zstd gzip
}
EOF'
- name: Reload server
run: ssh laniakea 'systemctl reload caddy'