Skip to content

Commit

Permalink
clean tmp files
Browse files Browse the repository at this point in the history
  • Loading branch information
barryib committed Mar 13, 2020
1 parent c5a71a3 commit ee836f4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
.PHONY: changelog release

SEMTAG=tools/semtag
OLD_CHANGELOG_LAST_TAG=v10.0.0

CHANGELOG_FILE=CHANGELOG.md
OLD_CHANGELOG_LAST_TAG=v10.0.0
TAG_QUERY=$(OLD_CHANGELOG_LAST_TAG)..

BEGIN_PLACEHOLDER:=<!-- BEGIN GIT-CHGLOG -->
END_PLACEHOLDER:=<!-- END GIT-CHGLOG -->
TAG_QUERY=$(OLD_CHANGELOG_LAST_TAG)..

TMPFILE:=$(shell mktemp /tmp/terraform-aws-eks.XXXXXX)
TMPFILE_CHANGELOG:=$(shell mktemp /tmp/terraform-aws-eks.XXXXXX)

# DARWIN:=$(shell uname -a | head -1 | grep -c Darwin && true)

# ToDo: Make compatible with sed and GNUsed (or test if GNU sed is present)
SED:=$(shell which gsed)

scope ?= "minor"

changelog-unrelease:
git-chglog $(TAG_QUERY) | grep -v $(OLD_CHANGELOG_LAST_TAG) > $(TMPFILE)
$(SED) '/$(BEGIN_PLACEHOLDER)/,/$(END_PLACEHOLDER)/{//!d}' $(CHANGELOG_FILE) > $(TMPFILE_CHANGELOG)
$(SED) -i '/$(BEGIN_PLACEHOLDER)/r $(TMPFILE)' $(TMPFILE_CHANGELOG)
mv $(TMPFILE_CHANGELOG) $(CHANGELOG_FILE)
mv $(TMPFILE_CHANGELOG) $(CHANGELOG_FILE) && rm -f $(TMPFILE)

changelog:
git-chglog --next-tag `$(SEMTAG) final -s $(scope) -o -f` $(TAG_QUERY) | grep -v $(OLD_CHANGELOG_LAST_TAG) > $(TMPFILE)
$(SED) '/$(BEGIN_PLACEHOLDER)/,/$(END_PLACEHOLDER)/{//!d}' $(CHANGELOG_FILE) > $(TMPFILE_CHANGELOG)
$(SED) -i '/$(BEGIN_PLACEHOLDER)/r $(TMPFILE)' $(TMPFILE_CHANGELOG)
mv $(TMPFILE_CHANGELOG) $(CHANGELOG_FILE)
mv $(TMPFILE_CHANGELOG) $(CHANGELOG_FILE) && rm -f $(TMPFILE)

release:
$(SEMTAG) final -s $(scope)
Expand Down

0 comments on commit ee836f4

Please sign in to comment.