PersonalSite/.gitea/workflows/hugo-deploy.yaml

38 lines
No EOL
1 KiB
YAML

name: Hugo Deploy Pipeline
run-name: Builds the Hugo site and Deploys via SSH to the Server
on:
push:
branches:
- main
jobs:
Build-and-Deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.128.0'
- name: Setup Rsync
uses: GuillaumeFalourd/setup-rsync@v1.2
- name: Build
run: hugo
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'placeholder' # to make it work
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -avz --delete ./public/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_TARGET }}