2024-09-22 23:07:55 +01:00
|
|
|
name: On_Push
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
# paths:
|
|
|
|
# - src/**/*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2024-09-23 22:31:47 +01:00
|
|
|
runs-on: docker
|
2024-09-22 23:07:55 +01:00
|
|
|
steps:
|
|
|
|
# get the repo first
|
|
|
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
# Make sure all files are pulled down
|
2024-09-23 22:31:47 +01:00
|
|
|
- uses: https://forgejo.skynet.ie/Skynet/actions/get_lfs@v6
|
2024-09-22 23:07:55 +01:00
|
|
|
with:
|
|
|
|
repository: ${{ gitea.repository }}
|
|
|
|
ref_name: ${{ gitea.ref_name }}
|
2025-02-13 14:01:52 +00:00
|
|
|
|
|
|
|
# Step 2: Install latest Hugo
|
|
|
|
- name: Install Hugo
|
|
|
|
run: |
|
|
|
|
HUGO_VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep -Po '"tag_name": "\K[^"]+' | sed 's/^v//')
|
|
|
|
wget -q https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-amd64.deb
|
|
|
|
dpkg -i ./hugo_extended_${HUGO_VERSION}_Linux-amd64.deb
|
|
|
|
hugo version
|
|
|
|
|
|
|
|
# Step 3: Ensure submodules or themes are initialized (only needed if your using github submodules for theme purposes)
|
|
|
|
- name: Initialize Submodules
|
|
|
|
run: git submodule update --init --recursive
|
|
|
|
|
|
|
|
# Step 4: Set the correct URL for skynet
|
|
|
|
- name: Set the site URL correctly
|
2025-02-13 14:07:05 +00:00
|
|
|
run: sed -i "s%baseURL.*%baseURL='https://${{ env.GITHUB_REPOSITORY_OWNER }}.users.skynet.ie'%" hugo.toml && cat hugo.toml
|
2025-02-13 14:01:52 +00:00
|
|
|
|
|
|
|
# Step 4: Build the Hugo site
|
|
|
|
- name: Build Hugo site
|
|
|
|
env:
|
|
|
|
HUGO_ENV: production
|
|
|
|
run: hugo --minify # Reduce resources by minifying content
|
|
|
|
|
|
|
|
# Step 5: Deploy the /public directory to the server
|
2024-09-23 22:31:47 +01:00
|
|
|
- uses: https://forgejo.skynet.ie/Skynet/actions/deploy_user@v6
|
2024-09-22 23:07:55 +01:00
|
|
|
with:
|
|
|
|
ssh_key: ${{ secrets.SSH_KEY }}
|
2024-09-23 22:31:47 +01:00
|
|
|
username: ${{ env.GITHUB_REPOSITORY_OWNER }}
|
2025-02-13 14:01:52 +00:00
|
|
|
folder: "public"
|
2024-09-23 22:31:47 +01:00
|
|
|
# uncomment below if you want to deploy to a subfolder
|
2024-09-22 23:07:55 +01:00
|
|
|
#destination: "subfolder"
|