Sam Tate
0d6d4a5ad0
Some checks failed
Hugo Deploy Pipeline / Build-and-Deploy (push) Has been cancelled
42 lines
No EOL
1.1 KiB
YAML
42 lines
No EOL
1.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:
|
|
lfs: true
|
|
submodules: true # Fetch Hugo themes (true OR recursive)
|
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
|
|
|
- name: Checkout LFS objects
|
|
run: git lfs checkout
|
|
|
|
- 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 --minify
|
|
|
|
- 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 }} |