From 4719a9d64c7d641d3e69ff5caadee97192ecf643 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Fri, 15 Dec 2023 23:51:38 -0500 Subject: [PATCH] feat(taskfiles): expose current version based on latest release or dev tag --- Taskfile.internal.yml | 4 ++++ Taskfile.yml | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/Taskfile.internal.yml b/Taskfile.internal.yml index a063027..ab6a809 100644 --- a/Taskfile.internal.yml +++ b/Taskfile.internal.yml @@ -8,10 +8,14 @@ tasks: prefix: "build image: {{ .SERVICE }}" dir: services/{{ .SERVICE }} cmd: . ./build.sh + env: + IMAGE_VERSION: "{{ .VERSION }}" start-service: prefix: "start: {{ .SERVICE }}" dir: services/{{ .SERVICE }} cmd: . ./start.sh + env: + IMAGE_VERSION: "{{ .VERSION }}" stop-service: prefix: "stop: {{ .SERVICE }}" dir: services/{{ .SERVICE }} diff --git a/Taskfile.yml b/Taskfile.yml index 05895f0..678a709 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -11,6 +11,11 @@ includes: output: prefixed +vars: + # Any build that is not on a tag is a development build. + CURRENT_VERSION: + sh: git describe --tags --exact-match $(git rev-parse HEAD) 2> /dev/null || echo "dev-$(git rev-parse HEAD)" + tasks: build: desc: "Builds images for one or more services. Include service names as a space-separated list." @@ -19,6 +24,7 @@ tasks: task: internal:build-images vars: SERVICE: "{{ .ITEM }}" + VERSION: "{{ .CURRENT_VERSION }}" prefix: "build: {{ .CLI_ARGS }}" dir: services start: @@ -28,6 +34,7 @@ tasks: task: internal:start-service vars: SERVICE: "{{ .ITEM }}" + VERSION: "{{ .CURRENT_VERSION }}" prefix: "start: {{ .CLI_ARGS }}" dir: services stop: