feat(build): use go-task instead of makefile

This commit is contained in:
Yorick Barbanneau 2025-01-28 23:05:55 +01:00
parent 558fc24911
commit 29b4399ff8
2 changed files with 33 additions and 29 deletions

View file

@ -1,29 +0,0 @@
# Includes
-include include.mk
# deploy variables
DEPLOY_BIN?=rsync
DEPLOY_OPTS?=-avz --delete
BUILD_OPTS?=--gc --cleanDestinationDir
BUILD_DEST?=public
.PHONY: serve
serve:
@hugo server -D --disableFastRender -v
.PHONY: build
build:
@hugo -d $(BUILD_DEST) $(BUILD_OPTIONS)
.PHONY: clean
clean:
@[ -d $(BUILD_DEST) ] && rm -rf $(BUILD_DEST)
.PHONY: deploy
deploy: build
ifeq ($(DEPLOY_SERVER),)
$(error DEPLOY_SERVER is not defined)
endif
[ -d $(BUILD_DEST) ] && $(DEPLOY_BIN) $(DEPLOY_OPTS) $(BUILD_DEST)/ $(DEPLOY_SERVER):$(DEPLOY_FOLDER)

33
Taskfile.dist.yaml Normal file
View file

@ -0,0 +1,33 @@
version: "3"
set: [errexit, pipefail, nounset]
shopt: [globstar]
dotenv:
- .env
vars:
HUGO_BIN: hugo
BUILD_OPTS: --gc --cleanDestinationDir
BUILD_DEST: public
SERVE_OPTS: -D --disableFastRender
DEPLOY_BIN: rsync
DEPLOY_OPTS: -avz --delete
tasks:
test:
cmds:
- echo "$DEPLOY_SRV"
build:
cmds:
- |
{{.HUGO_BIN}} {{.BUILD_OPTS}} -d {{.BUILD_DEST}}
serve:
cmds:
- |
{{.HUGO_BIN}} {{.SERVE_OPTS}}
deploy:
deps: [build]
cmds:
- |
{{.DEPLOY_BIN}} {{.DEPLOY_OPTS}} {{.BUILD_DEST}} {{.DEPLOY_SRV}}:{{.DEPLOY_DEST}}
requires:
vars:
- DEPLOY_SRV
- DEPLOY_DEST