forked from ungleich-public/cdist
release in Makefile is cumbersome, use shell
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
7646375218
commit
dc2b37cec1
2 changed files with 76 additions and 46 deletions
47
Makefile
47
Makefile
|
@ -170,39 +170,6 @@ $(FREECODE_FILE): $(CHANGELOG_FILE)
|
||||||
|
|
||||||
freecode-release: $(FREECODE_FILE)
|
freecode-release: $(FREECODE_FILE)
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# git and git dependent stuff
|
|
||||||
#
|
|
||||||
|
|
||||||
GIT_TAG_FILE=.git/refs/tags/$(CHANGELOG_VERSION)
|
|
||||||
GIT_SRC_BRANCH=master
|
|
||||||
GIT_DST_BRANCH=$(shell echo $(CHANGELOG_VERSION) | cut -d. -f '1,2')
|
|
||||||
GIT_CURRENT=.git-current-branch
|
|
||||||
|
|
||||||
git-tag: $(GIT_TAG_FILE)
|
|
||||||
|
|
||||||
$(GIT_TAG_FILE):
|
|
||||||
@printf "Enter tag description for $(CHANGELOG_VERSION)> "
|
|
||||||
@read tagmessage; git tag "$(CHANGELOG_VERSION)" -m "$$tagmessage"
|
|
||||||
|
|
||||||
git-branch-merge: git-checkout-stable
|
|
||||||
git merge "$(CHANGELOG_VERSION)"
|
|
||||||
|
|
||||||
git-checkout-stable: git-tag
|
|
||||||
@git rev-parse --abbrev-ref HEAD > $(GIT_CURRENT)
|
|
||||||
@git checkout "$(GIT_DST_BRANCH)"
|
|
||||||
|
|
||||||
git-checkout-current:
|
|
||||||
git checkout "$$(cat $(GIT_CURRENT))"
|
|
||||||
|
|
||||||
$(VERSION_FILE): .git/refs/heads/* .git/refs/tags/* .git/HEAD
|
|
||||||
echo "VERSION = \"$$(git describe)\"" > $@
|
|
||||||
|
|
||||||
git-release: git-tag
|
|
||||||
make git-branch-merge
|
|
||||||
make git-checkout-current
|
|
||||||
make pub
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# pypi
|
# pypi
|
||||||
#
|
#
|
||||||
|
@ -236,20 +203,8 @@ archlinux-release: $(ARCHLINUX_FILE)
|
||||||
# Release
|
# Release
|
||||||
#
|
#
|
||||||
|
|
||||||
CHECKS=check-date check-unittest
|
|
||||||
|
|
||||||
check-unittest: $(VERSION_FILE)
|
|
||||||
|
|
||||||
RELEASE=speeches-dist web-release
|
|
||||||
RELEASE+=ml-release freecode-release
|
|
||||||
RELEASE+=man-dist pypi-release git-release
|
|
||||||
RELEASE+=archlinux-release
|
|
||||||
|
|
||||||
release: $(CHECKS) $(RELEASE)
|
|
||||||
echo "Manual steps: linkedin, twitter"
|
|
||||||
|
|
||||||
# Code that is better handled in a shell script
|
# Code that is better handled in a shell script
|
||||||
check-%:
|
check-% release:
|
||||||
$(helper) $@
|
$(helper) $@
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -173,11 +173,82 @@ eof
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
release-git-tag)
|
||||||
|
target_version=$($0 changelog-version)
|
||||||
|
if git rev-parse --verify refs/tags/$target_version; then
|
||||||
|
echo "Tag for $target_version exists, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
printf "Enter tag description for ${target_version}: "
|
||||||
|
read tagmessage
|
||||||
|
git tag "$target_version" -m "$$tagmessage"
|
||||||
|
;;
|
||||||
|
|
||||||
release)
|
release)
|
||||||
set -e
|
set -e
|
||||||
|
target_version=$($0 changelog-version)
|
||||||
|
target_branch=$($0 version-branch)
|
||||||
|
|
||||||
|
echo "Beginning release process for $target_version"
|
||||||
|
|
||||||
# First check everything is sane
|
# First check everything is sane
|
||||||
"$0" check-date
|
"$0" check-date
|
||||||
"$0" check-unittest
|
"$0" check-unittest
|
||||||
|
|
||||||
|
# Generate version file to be included in packaging
|
||||||
|
"$0" version
|
||||||
|
|
||||||
|
# Ensure the git status is clean, else abort
|
||||||
|
if ! git diff-index --exit-code --quiet HEAD; then
|
||||||
|
echo "Unclean tree, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure we are on the master branch
|
||||||
|
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
|
||||||
|
echo "Releases are happening from the master branch, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure version branch exists
|
||||||
|
if ! git rev-parse --verify refs/heads/$target_branch 2>/dev/null; then
|
||||||
|
git branch "$target_branch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Merge master branch into version branch
|
||||||
|
git checkout "$target_branch"
|
||||||
|
git merge master
|
||||||
|
|
||||||
|
# Verify that after the merge everything works
|
||||||
|
"$0" check-date
|
||||||
|
"$0" check-unittest
|
||||||
|
|
||||||
|
# Generate man pages (indirect check if they build)
|
||||||
|
make man
|
||||||
|
|
||||||
|
# Generate speeches (indirect check if they build)
|
||||||
|
make speeches
|
||||||
|
|
||||||
|
#############################################################
|
||||||
|
# Everything green, let's do the release
|
||||||
|
|
||||||
|
# Tag the current commit
|
||||||
|
"$0" release-git-tag
|
||||||
|
|
||||||
|
# Also merge back the version branch
|
||||||
|
git checkout master
|
||||||
|
git merge "$target_branch"
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
make speeches-dist
|
||||||
|
|
||||||
|
RELEASE=speeches-dist web-release
|
||||||
|
RELEASE+=ml-release freecode-release
|
||||||
|
RELEASE+=man-dist pypi-release git-release
|
||||||
|
RELEASE+=archlinux-release
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
test)
|
test)
|
||||||
|
@ -190,6 +261,10 @@ eof
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
version-branch)
|
||||||
|
"$0" changelog-version | cut -d. -f '1,2'
|
||||||
|
;;
|
||||||
|
|
||||||
version)
|
version)
|
||||||
echo "VERSION = \"$(git describe)\"" > cdist/version.py
|
echo "VERSION = \"$(git describe)\"" > cdist/version.py
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue