Skip to content

Commit 576183d

Browse files
committed
Factor out latest tag into variable
1 parent 994b874 commit 576183d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ MAKEFLAGS += --silent
22
SHELL = /usr/bin/env bash
33

44
_IMAGE_NAME = duolingo/pre-commit-hooks
5+
_LATEST_TAG = $(shell git tag | sort -V | tail -1)
56

67
# Bumps this project's version number. Example: make release V=1.0.3
78
.PHONY: release
@@ -14,7 +15,7 @@ release: test
1415
# Update source files and commit
1516
echo 'Creating release commit...'
1617
git grep --cached -z -l '' | xargs -0 sed -E -i '' -e \
17-
"s@( rev: | entry: $(_IMAGE_NAME):)$$(git tag | sort -V | tail -1)@\1${V}@g"
18+
"s@( rev: | entry: $(_IMAGE_NAME):)$(_LATEST_TAG)@\1${V}@g"
1819
git add -A
1920
git commit -m "Release ${V}" -n
2021

@@ -35,7 +36,7 @@ push: test
3536
# https://stackoverflow.com/a/69987949
3637
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
3738
docker buildx build --push --platform linux/amd64,linux/arm64 \
38-
-t "$(_IMAGE_NAME):$$(git tag | tail -1)" \
39+
-t "$(_IMAGE_NAME):$(_LATEST_TAG)" \
3940
-t "$(_IMAGE_NAME):latest" \
4041
.
4142

0 commit comments

Comments
 (0)