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-12-23 23:14:25 +00:00
|
|
|
container:
|
|
|
|
image: node:latest
|
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
|
2024-01-11 20:05:36 +00:00
|
|
|
- name: Optimize images
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
apt update
|
|
|
|
apt install imagemagick -y
|
|
|
|
./themes/kobel/assets/build/images.sh
|
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-12-23 23:15:42 +00:00
|
|
|
container:
|
|
|
|
image: node:latest
|
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
|
2023-12-23 23:24:35 +00:00
|
|
|
shell: bash
|
2023-12-23 23:20:01 +00:00
|
|
|
run: apt update && apt install unzip -y && unzip public.zip -d . && shopt -s dotglob && mv ./public/* ./
|
2023-10-28 20:12:07 +00:00
|
|
|
- name: Publish
|
|
|
|
run: |
|
2023-10-20 20:53:21 +00:00
|
|
|
git config user.name "forgejo-actions"
|
|
|
|
git config user.email ""
|
|
|
|
git add .
|
|
|
|
git commit -m "generated"
|
|
|
|
git push
|