2024-06-27 23:50:38 +01:00
|
|
|
name: Hugo Deploy Pipeline
|
|
|
|
run-name: Builds the Hugo site and Deploys via SSH to the Server
|
2024-06-28 11:08:57 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-06-27 22:56:36 +01:00
|
|
|
|
|
|
|
jobs:
|
2024-06-27 23:24:15 +01:00
|
|
|
Build-and-Deploy:
|
2024-06-27 22:56:36 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-06-27 23:24:15 +01:00
|
|
|
- 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'
|
|
|
|
|
2024-06-29 14:10:44 +01:00
|
|
|
- name: Setup Rsync
|
|
|
|
uses: GuillaumeFalourd/setup-rsync@v1.2
|
2024-06-29 14:09:13 +01:00
|
|
|
|
2024-06-27 23:24:15 +01:00
|
|
|
- name: Build
|
2024-06-27 23:34:45 +01:00
|
|
|
run: hugo --minify
|
|
|
|
|
2024-06-29 14:06:54 +01:00
|
|
|
- name: Install SSH Key
|
|
|
|
uses: shimataro/ssh-key-action@v2
|
2024-06-27 23:34:45 +01:00
|
|
|
with:
|
2024-06-29 14:06:54 +01:00
|
|
|
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 }}
|