Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,17 @@ jobs:
submodules: recursive
fetch-depth: 1

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.147.9"
extended: true

- name: Setup Pages
id: pages
uses: actions/configure-pages@v4

- name: Build static
run: make build_static

- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
BASE_URL: "${{ steps.pages.outputs.base_url }}/"
run: make build
run: make build UID=$(id -u) GID=$(id -g)

- name: Upload artifact
if: github.ref_name == github.event.repository.default_branch
Expand Down
27 changes: 23 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
.PHONY: build_hugo run docker_cv_build
.DEFAULT_GOAL := build

HUGO_VERSION := 0.148.1
HUGO_IMAGE := ghcr.io/gohugoio/hugo:v$(HUGO_VERSION)
STATIC_DIR := static

WORKDIR := $(abspath .)
UID ?= 0
GID ?= 0

#
# Resume
Expand All @@ -21,7 +25,7 @@ $(RESUME_PDF): $(RESUME_SRC)
--rm \
--network=none \
--workdir="/app/out" \
-u "0:0" \
-u "$(UID):$(GID)" \
-v "$(abspath $(RESUME_DIR)):/app" \
$(YAMLRESUME_IMAGE) \
build ../cv.yml
Expand All @@ -37,13 +41,28 @@ build_static: $(RESUME_STATIC_PDF)

build_hugo: build_static
@echo "Building hugo"
@hugo --gc --minify $(if $(BASE_URL),--baseURL $(BASE_URL),)
@docker run \
--rm \
--network=none \
--env HUGO_ENVIRONMENT=production \
--env HUGO_ENV=production \
-u "$(UID):$(GID)" \
-v "$(WORKDIR):/project" \
$(HUGO_IMAGE) \
build --minify $(if $(BASE_URL),--baseURL $(BASE_URL),) $(if $(CI),--noBuildLock, --gc)

build: build_hugo

run: build_static
@echo "Running hugo"
@hugo server -D
@docker run \
--rm \
--workdir="/app" \
-p 1313:1313 \
-u "$(UID):$(GID)" \
-v "$(WORKDIR):/project" \
$(HUGO_IMAGE) \
server --bind 0.0.0.0 --buildDrafts --watch --disableFastRender

clean:
@git clean -xdf
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Mortz's Corner website

### Dependencies
* Hugo (> v0.122)
* Docker (> 24)
* Docker (> 24)