From f89f5b50fb85eebf16049428e463fd67efdf2655 Mon Sep 17 00:00:00 2001 From: Bartal Laearsson Date: Mon, 29 Jun 2026 23:29:33 +0100 Subject: [PATCH] change taskfile --- Taskfile.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 74c0e15..8aa2988 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -30,7 +30,7 @@ tasks: build-api: desc: clean, then build api bin cmds: - - task clean-api + - go tool task clean-api - mkdir -p {{.BINARY_DIR}} - echo "building {{.BINARY_API}} with version {{.VERSION_STR}}" - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "{{.LD_FLAGS}}" -o {{.BINARY_API}} ./cmd/api @@ -44,7 +44,7 @@ tasks: dev-build-api: desc: clean, then build DEV api bin cmds: - - task dev-clean-api + - go tool task dev-clean-api - mkdir -p {{.DEV_BINARY_API}} - echo "building DEV {{.DEV_BINARY_API}} with version {{.VERSION_STR}}" - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "{{.LD_FLAGS}}" -o {{.DEV_BINARY_API}}/go-api ./cmd/api @@ -52,12 +52,13 @@ tasks: # ── Deploy individual ────────────────────────────────────────────────────── deploy-api: - desc: build api, create remote dirs, and deploy api to remote vps + desc: build api, stage files, and deploy api to remote server deps: [build-api] cmds: - - ssh {{.REMOTE_MACHINE}} "rm -f /srv/go-api/go-api" - - rsync -avz --delete {{.BINARY_API}} {{.REMOTE_MACHINE}}:/srv/go-api/ - - ssh -t {{.REMOTE_MACHINE}} "sudo systemctl restart go-api" + - ssh {{.REMOTE_MACHINE}} "rm -rf /tmp/go-api-deploy && mkdir -p /tmp/go-api-deploy" + - rsync -avz --delete {{.BINARY_API}} {{.REMOTE_MACHINE}}:/tmp/go-api-deploy/ + - ssh -t {{.REMOTE_MACHINE}} "sudo rsync -a --delete --exclude='.env' --exclude='config.json' --exclude='data/' --chown=go-api:go-api /tmp/go-api-deploy/ /opt/go-api/ && sudo systemctl restart go-api" + - ssh {{.REMOTE_MACHINE}} "rm -rf /tmp/go-api-deploy" # ── DEV START individual ────────────────────────────────────────────────── @@ -66,7 +67,7 @@ tasks: dir: "{{ .DEV_BINARY_API }}" cmds: - "rm -rf *" - - task dev-build-api + - go tool task dev-build-api - "./go-api" run: