From 930c19cf7bc4b3015d09b453b1104c54915df96b Mon Sep 17 00:00:00 2001 From: George Garside Date: Thu, 28 Mar 2024 21:52:38 +0000 Subject: [PATCH] Simplify Makefile --- Makefile | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 1bf7dc6..61f1448 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,22 @@ -all: publish - .SUFFIXES: +version = $(shell git describe | tr "-" "." | awk -F. -vOFS=. '{if (NF>3) {NF=3; $NF++;} print}' | cut -c 2-) +file = dotfiles-${version}.vsix +vsce-flags = -file = dotfiles-$(shell git describe).vsix -tag = $(shell git describe --abbrev=0 | awk -F. -v OFS=. '{$$NF++ ; print}') +all: ${file} -.PHONY changelog: CHANGELOG.md CHANGELOG.md: .git/refs/heads/main - echo "# Changelog\n### ${tag}" >$@ + echo "# Changelog\n### v${version}" >$@ git log --oneline --decorate-refs='tags/*' --format="%(decorate:prefix=### ,suffix=%n,tag=)%n- %w(0,0,2)%B" >>$@ -version: CHANGELOG.md - npm version ${tag} --no-git-tag-version +.git/refs/tags/v${version}: CHANGELOG.md + npm version ${version} --no-git-tag-version git add package.json package-lock.json CHANGELOG.md git commit --amend --no-edit - git tag -afsm "" ${tag} - git push origin main ${tag} - -.PHONY package: ${file} -${file}: version - npx vsce package + git tag -afsm "" v${version} + git push origin main v${version} -publish: ${file} CHANGELOG.md - npx vsce publish -i ${file} - git log --oneline --decorate-refs='tags/*' --format="- %w(0,0,2)%B" (git describe --tags --abbrev=0 @^)... | gh release create ${tag} --notes-file - ${file} +${file}: CHANGELOG.md .git/refs/tags/v${version} + npx vsce package ${vsce-flags} ${version} + npx vsce publish -i ${file} ${vsce-flags} + git log --oneline --decorate-refs='tags/*' --format="- %w(0,0,2)%B" (git describe --tags --abbrev=0 @^)... | gh release create v${version} --notes-file - ${file}