feat(taskfiles): expose current version based on latest release or dev tag

This commit is contained in:
Marc 2023-12-15 23:51:38 -05:00
parent b668a45810
commit 4719a9d64c
Signed by: marc
GPG key ID: 048E042F22B5DC79
2 changed files with 11 additions and 0 deletions

View file

@ -8,10 +8,14 @@ tasks:
prefix: "build image: {{ .SERVICE }}" prefix: "build image: {{ .SERVICE }}"
dir: services/{{ .SERVICE }} dir: services/{{ .SERVICE }}
cmd: . ./build.sh cmd: . ./build.sh
env:
IMAGE_VERSION: "{{ .VERSION }}"
start-service: start-service:
prefix: "start: {{ .SERVICE }}" prefix: "start: {{ .SERVICE }}"
dir: services/{{ .SERVICE }} dir: services/{{ .SERVICE }}
cmd: . ./start.sh cmd: . ./start.sh
env:
IMAGE_VERSION: "{{ .VERSION }}"
stop-service: stop-service:
prefix: "stop: {{ .SERVICE }}" prefix: "stop: {{ .SERVICE }}"
dir: services/{{ .SERVICE }} dir: services/{{ .SERVICE }}

View file

@ -11,6 +11,11 @@ includes:
output: prefixed 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: tasks:
build: build:
desc: "Builds images for one or more services. Include service names as a space-separated list." 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 task: internal:build-images
vars: vars:
SERVICE: "{{ .ITEM }}" SERVICE: "{{ .ITEM }}"
VERSION: "{{ .CURRENT_VERSION }}"
prefix: "build: {{ .CLI_ARGS }}" prefix: "build: {{ .CLI_ARGS }}"
dir: services dir: services
start: start:
@ -28,6 +34,7 @@ tasks:
task: internal:start-service task: internal:start-service
vars: vars:
SERVICE: "{{ .ITEM }}" SERVICE: "{{ .ITEM }}"
VERSION: "{{ .CURRENT_VERSION }}"
prefix: "start: {{ .CLI_ARGS }}" prefix: "start: {{ .CLI_ARGS }}"
dir: services dir: services
stop: stop: