56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: Build and deploy Hugo site
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: act_runner1
|
|
container:
|
|
image: 192.168.254.5:5000/hugo:v0.163.3
|
|
options: --privileged
|
|
steps:
|
|
- name: Create Hugo site
|
|
run: |
|
|
set -e
|
|
hugo new site /tmp/hugo-site
|
|
|
|
- name: Clone repository to content directory
|
|
run: |
|
|
set -e
|
|
REPO_URL="http://192.168.8.126:3000/blogs/outcomes.git"
|
|
if [ -n "${CI_REPOSITORY_URL:-}" ]; then
|
|
REPO_URL="${CI_REPOSITORY_URL}"
|
|
fi
|
|
echo "Cloning $REPO_URL to content directory"
|
|
git clone --depth=1 "$REPO_URL" /tmp/hugo-site/content
|
|
|
|
- name: Copy config file to Hugo site
|
|
run: |
|
|
set -e
|
|
cp /tmp/hugo-site/content/config.toml /tmp/hugo-site/
|
|
|
|
- name: Build site with Hugo
|
|
working-directory: /tmp/hugo-site
|
|
run: |
|
|
set -e
|
|
hugo --minify
|
|
|
|
- name: Show generated files
|
|
working-directory: /tmp/hugo-site
|
|
run: |
|
|
echo "Public directory contents:"
|
|
ls -la public || true
|
|
|
|
- name: Deploy to remote server
|
|
working-directory: /tmp/hugo-site
|
|
run: |
|
|
set -e
|
|
# Debug: check if config file exists
|
|
echo "Config file contents:"
|
|
cat config.toml || echo "Config file not found"
|
|
# Setup SSH key for Hugo deploy
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H 192.168.254.5 >> ~/.ssh/known_hosts
|
|
# Deploy using Hugo
|
|
hugo deploy |