Files
homelab/.gitea/workflows/Hugo-deploy.yaml
DontDDoS fdc40bdd31
Some checks failed
hugo deploy / build-and-deploy (push) Failing after 38s
chore: commit user-made changes
2026-01-11 01:00:58 +00:00

52 lines
1.6 KiB
YAML

name: hugo deploy
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Hugo
run: |
sudo apt-get update
sudo apt-get install -y wget tar openssh-client git
HUGO_VERSION=0.154.1
ARCH=Linux-64bit
wget -q https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_${ARCH}.tar.gz -O /tmp/hugo.tar.gz
tar -xzf /tmp/hugo.tar.gz -C /tmp
sudo mv /tmp/hugo /usr/local/bin/hugo
hugo version
- name: Ensure submodules
run: |
git submodule sync --recursive
git submodule update --init --recursive
- name: Build site
run: |
hugo -s website -d public
- name: Configure SSH
env:
HUGO_DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.HUGO_DEPLOY_SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$HUGO_DEPLOY_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
chmod 700 ~/.ssh
- name: Deploy to server
run: |
echo "Deploying from website/public"
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null hugo-deploy@10.20.20.102 "mkdir -p /opt/containers/website/content && rm -rf /opt/containers/website/content/*"
scp website/public/* hugo-deploy@10.20.20.102:/opt/containers/website/content/