Skip to content

Commit

Permalink
Makefile: automate changelog & release
Browse files Browse the repository at this point in the history
Changelog is automatically generated in a new file (prechangelog.rst),
to be edited and reviewed before final submission.

The version in ``.vimrc`` is also updated automatically according to the
new version being released.

Once this is done, changes are ready for commit and tag. The message for
these git objects should be the part of the changelog corresponding to
this version.

:smiley:
  • Loading branch information
rmariano committed Mar 18, 2017
1 parent 06bcd1e commit 9ec30c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ nosetests.xml
# Swap Files
*.sw[op]
*~
prechangelog.rst
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ TARGET_COLORS := $(COLORS_DIR)/tromso.vim

SOURCE_SYNTAX := $(PWD)/syntax/python.vim
TARGET_SYNTAX := $(SYNTAX_DIR)/python.vim
PRECHANGELOG = prechangelog.rst
YELLOW := \e[93m
RED := \e[91m

all: install

Expand Down Expand Up @@ -75,14 +78,26 @@ install: dirs
@wget -O $(TARGET_COLORS) $(REMOTELOC)/colors/tromso.vim
@wget -O $(TARGET_SYNTAX) $(REMOTELOC)/syntax/python.vim

# make changelog TAG=<tag>
.PHONY: changelog
changelog:
@git log --no-merges master.. --oneline --pretty=format:" * %s"
@echo "Change Log" >> $(PRECHANGELOG)
@echo -e "==========\n" >> $(PRECHANGELOG)
@echo "$(TAG) ($(shell date --rfc-3339=date))" >> $(PRECHANGELOG)
@echo "-----------------" >> $(PRECHANGELOG)
@git log --no-merges master.. --oneline --pretty=format:"* %s" >> $(PRECHANGELOG)
@echo -ne "\n\n" >> $(PRECHANGELOG)
@tail -n +4 changelog.rst >> $(PRECHANGELOG)
@sed -i 's/\(" Version:\).*/\1 $(TAG)/g' $(PWD)/.vimrc
@echo -e "$(RED)$(PRECHANGELOG) $(YELLOW)created. Adjust & review status before releasing!"

# make release TAG=<tag>
.PHONY: release
release:
git tag -S $(TAG)
release: $(PRECHANGELOG)
mv {pre,}changelog.rst
git add .
git commit
git tag -s $(TAG)

.PHONY: clean
clean:
Expand Down

0 comments on commit 9ec30c4

Please sign in to comment.