generated from Skynet/deploy_user
38 lines
No EOL
1.3 KiB
YAML
38 lines
No EOL
1.3 KiB
YAML
name: On_Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
steps:
|
|
# Step 1: Checkout the repository
|
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
# 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: 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
|
|
- uses: https://forgejo.skynet.ie/Skynet/actions/deploy_user@v6
|
|
with:
|
|
ssh_key: ${{ secrets.SSH_KEY }}
|
|
username: ${{ env.GITHUB_REPOSITORY_OWNER }}
|
|
folder: "public" |