Skip to content

Commit

Permalink
Run hugo via go run and lock its version (#22206)
Browse files Browse the repository at this point in the history
- Don't rely on obscure docker images like `plugins/hugo`
- Lock down `hugo` to same version the image had used
- Remove unnecessary verbosity in `trans-copy`
- Rename `trans-copy` to `trans-copy.sh`

Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: John Olheiser <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
  • Loading branch information
4 people authored Dec 22, 2022
1 parent 8e17fb5 commit 3affb02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 1 addition & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,8 @@ trigger:

steps:
- name: build-docs
image: plugins/hugo:latest
pull: always
image: golang:1.19
commands:
# https://github.com/drone-plugins/drone-hugo/issues/36
- apk upgrade --no-cache libcurl && apk add --no-cache make bash curl
- cd docs
- make trans-copy clean build

Expand Down
10 changes: 6 additions & 4 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ THEME := themes/gitea
PUBLIC := public
ARCHIVE := https://dl.gitea.io/theme/master.tar.gz

HUGO_PACKAGE := github.com/gohugoio/[email protected]

.PHONY: all
all: build

Expand All @@ -11,19 +13,19 @@ clean:

.PHONY: trans-copy
trans-copy:
@bash scripts/trans-copy
bash scripts/trans-copy.sh

.PHONY: server
server: $(THEME)
hugo server
go run $(HUGO_PACKAGE) server

.PHONY: build
build: $(THEME)
hugo --cleanDestinationDir
go run $(HUGO_PACKAGE) --cleanDestinationDir

.PHONY: build-offline
build-offline: $(THEME)
hugo --baseURL="/" --cleanDestinationDir
go run $(HUGO_PACKAGE) --baseURL="/" --cleanDestinationDir

.PHONY: update
update: $(THEME)
Expand Down
1 change: 0 additions & 1 deletion docs/scripts/trans-copy → docs/scripts/trans-copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ for SOURCE in $(find ${ROOT}/content -type f -iname *.en-us.md); do
DEST="${SOURCE%.en-us.md}.${LOCALE}.md"

if [[ ! -f ${DEST} ]]; then
echo "Creating fallback for ${DEST#${ROOT}/content/}"
cp ${SOURCE} ${DEST}
sed -i.bak "s/en\-us/${LOCALE}/g" ${DEST}
rm ${DEST}.bak
Expand Down

0 comments on commit 3affb02

Please sign in to comment.