2023-10-20 20:53:21 +00:00
|
|
|
name: build-to-pages
|
|
|
|
on: [push]
|
|
|
|
branches: [main]
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-10-21 19:08:09 +00:00
|
|
|
runs-on: docker
|
2023-10-22 19:43:31 +00:00
|
|
|
env:
|
|
|
|
HUGO_VERSION: 0.115.4
|
2023-10-20 20:53:21 +00:00
|
|
|
steps:
|
2023-10-22 19:13:02 +00:00
|
|
|
- name: Install Hugo CLI
|
2023-10-22 19:42:49 +00:00
|
|
|
run: |
|
|
|
|
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
|
|
|
&& dpkg -i ${{ runner.temp }}/hugo.deb
|
2023-10-22 19:26:55 +00:00
|
|
|
- name: Install Dart Sass
|
2023-10-22 19:45:53 +00:00
|
|
|
run: npm i -g sass
|
2023-10-21 19:41:58 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-10-21 18:54:48 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
2023-10-28 20:01:27 +00:00
|
|
|
- name: Build with hugo
|
2023-10-21 19:04:14 +00:00
|
|
|
env:
|
|
|
|
# For maximum backward compatibility with Hugo modules
|
|
|
|
HUGO_ENVIRONMENT: production
|
|
|
|
HUGO_ENV: production
|
|
|
|
run: hugo --minify
|
2023-10-28 19:32:32 +00:00
|
|
|
- name: Zip output
|
|
|
|
run: apt update && apt install zip -y && zip -r public.zip public/
|
2023-10-21 18:54:48 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: hugo-output
|
2023-10-28 19:32:32 +00:00
|
|
|
path: ./public.zip
|
2023-10-21 18:54:48 +00:00
|
|
|
if-no-files-found: error
|
2023-10-28 19:36:38 +00:00
|
|
|
retention-days: 1
|
2023-10-20 20:53:21 +00:00
|
|
|
push:
|
2023-10-21 19:08:09 +00:00
|
|
|
runs-on: docker
|
2023-10-20 20:53:21 +00:00
|
|
|
steps:
|
2023-10-21 19:41:58 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-10-21 18:54:48 +00:00
|
|
|
with:
|
2023-10-28 17:25:47 +00:00
|
|
|
ref: public
|
2023-10-28 20:01:27 +00:00
|
|
|
- name: Clean current files in directory
|
2023-10-28 20:04:13 +00:00
|
|
|
run: rm -rf *
|
2023-10-21 18:54:48 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: hugo-output
|
2023-10-28 20:01:27 +00:00
|
|
|
- name: Unzip hugo output
|
|
|
|
run: apt update && apt install unzip -y && unzip hugo-output/public.zip -d . && mv ./public/* ./
|
2023-10-20 20:53:21 +00:00
|
|
|
- run: |
|
|
|
|
git config user.name "forgejo-actions"
|
|
|
|
git config user.email ""
|
|
|
|
git add .
|
|
|
|
git commit -m "generated"
|
|
|
|
git push
|