Skip to content

Commit

Permalink
Simplify Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
grgar committed Mar 29, 2024
1 parent 8d283fe commit 930c19c
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 930c19c

Please sign in to comment.