build: make VERSION file be master of the last release - fixes #3570

Prior to this beta releases would appear to be older than the point
release, eg v1.49.0-096-gc41812fc which was released after v1.49.3 and
contains all the patches from v1.49.3.
This commit is contained in:
Nick Craig-Wood 2019-09-17 14:22:47 +01:00
parent 4a8a8578a5
commit 9054542be5
3 changed files with 64 additions and 32 deletions

View file

@ -1,18 +1,29 @@
SHELL = bash SHELL = bash
# Branch we are working on
BRANCH := $(or $(APPVEYOR_REPO_BRANCH),$(TRAVIS_BRANCH),$(BUILD_SOURCEBRANCHNAME),$(lastword $(subst /, ,$(GITHUB_REF))),$(shell git rev-parse --abbrev-ref HEAD)) BRANCH := $(or $(APPVEYOR_REPO_BRANCH),$(TRAVIS_BRANCH),$(BUILD_SOURCEBRANCHNAME),$(lastword $(subst /, ,$(GITHUB_REF))),$(shell git rev-parse --abbrev-ref HEAD))
# Tag of the current commit, if any. If this is not "" then we are building a release
RELEASE_TAG := $(shell git tag -l --points-at HEAD)
# Version of last release (may not be on this branch)
VERSION := $(shell cat VERSION)
# Last tag on this branch
LAST_TAG := $(shell git describe --tags --abbrev=0) LAST_TAG := $(shell git describe --tags --abbrev=0)
ifeq ($(BRANCH),$(LAST_TAG)) # If we are working on a release, override branch to master
ifdef RELEASE_TAG
BRANCH := master BRANCH := master
endif endif
TAG_BRANCH := -$(BRANCH) TAG_BRANCH := -$(BRANCH)
BRANCH_PATH := branch/ BRANCH_PATH := branch/
# If building HEAD or master then unset TAG_BRANCH and BRANCH_PATH
ifeq ($(subst HEAD,,$(subst master,,$(BRANCH))),) ifeq ($(subst HEAD,,$(subst master,,$(BRANCH))),)
TAG_BRANCH := TAG_BRANCH :=
BRANCH_PATH := BRANCH_PATH :=
endif endif
TAG := $(shell echo $$(git describe --abbrev=8 --tags | sed 's/-\([0-9]\)-/-00\1-/; s/-\([0-9][0-9]\)-/-0\1-/'))$(TAG_BRANCH) # Make version suffix -DDD-gCCCCCCCC (D=commits since last relase, C=Commit) or blank
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f.0", $$_)') VERSION_SUFFIX := $(shell git describe --abbrev=8 --tags | perl -lpe 's/^v\d+\.\d+\.\d+//; s/^-(\d+)/"-".sprintf("%03d",$$1)/e;')
ifneq ($(TAG),$(LAST_TAG)) # TAG is current version + number of commits since last release + branch
TAG := $(VERSION)$(VERSION_SUFFIX)$(TAG_BRANCH)
NEXT_VERSION := $(shell echo $(VERSION) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f.0", $$_)')
ifndef RELEASE_TAG
TAG := $(TAG)-beta TAG := $(TAG)-beta
endif endif
GO_VERSION := $(shell go version) GO_VERSION := $(shell go version)
@ -44,8 +55,8 @@ vars:
@echo SHELL="'$(SHELL)'" @echo SHELL="'$(SHELL)'"
@echo BRANCH="'$(BRANCH)'" @echo BRANCH="'$(BRANCH)'"
@echo TAG="'$(TAG)'" @echo TAG="'$(TAG)'"
@echo LAST_TAG="'$(LAST_TAG)'" @echo VERSION="'$(VERSION)'"
@echo NEW_TAG="'$(NEW_TAG)'" @echo NEXT_VERSION="'$(NEXT_VERSION)'"
@echo GO_VERSION="'$(GO_VERSION)'" @echo GO_VERSION="'$(GO_VERSION)'"
@echo BETA_URL="'$(BETA_URL)'" @echo BETA_URL="'$(BETA_URL)'"
@ -192,24 +203,25 @@ serve: website
cd docs && hugo server -v -w cd docs && hugo server -v -w
tag: doc tag: doc
@echo "Old tag is $(LAST_TAG)" @echo "Old tag is $(VERSION)"
@echo "New tag is $(NEW_TAG)" @echo "New tag is $(NEXT_VERSION)"
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEW_TAG)\"\n" | gofmt > fs/version.go echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEXT_VERSION)\"\n" | gofmt > fs/version.go
echo -n "$(NEW_TAG)" > docs/layouts/partials/version.html echo -n "$(NEXT_VERSION)" > docs/layouts/partials/version.html
git tag -s -m "Version $(NEW_TAG)" $(NEW_TAG) echo "$(NEXT_VERSION)" > VERSION
bin/make_changelog.py $(LAST_TAG) $(NEW_TAG) > docs/content/changelog.md.new git tag -s -m "Version $(NEXT_VERSION)" $(NEXT_VERSION)
bin/make_changelog.py $(LAST_TAG) $(NEXT_VERSION) > docs/content/changelog.md.new
mv docs/content/changelog.md.new docs/content/changelog.md mv docs/content/changelog.md.new docs/content/changelog.md
@echo "Edit the new changelog in docs/content/changelog.md" @echo "Edit the new changelog in docs/content/changelog.md"
@echo "Then commit all the changes" @echo "Then commit all the changes"
@echo git commit -m \"Version $(NEW_TAG)\" -a -v @echo git commit -m \"Version $(NEXT_VERSION)\" -a -v
@echo "And finally run make retag before make cross etc" @echo "And finally run make retag before make cross etc"
retag: retag:
git tag -f -s -m "Version $(LAST_TAG)" $(LAST_TAG) git tag -f -s -m "Version $(VERSION)" $(VERSION)
startdev: startdev:
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(LAST_TAG)-DEV\"\n" | gofmt > fs/version.go echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(VERSION)-DEV\"\n" | gofmt > fs/version.go
git commit -m "Start $(LAST_TAG)-DEV development" fs/version.go git commit -m "Start $(VERSION)-DEV development" fs/version.go
winzip: winzip:
zip -9 rclone-$(TAG).zip rclone.exe zip -9 rclone-$(TAG).zip rclone.exe

View file

@ -48,26 +48,45 @@ Can be fixed with
* GO111MODULE=on go mod vendor * GO111MODULE=on go mod vendor
Making a point release. If rclone needs a point release due to some ## Making a point release
horrendous bug, then
* git branch v1.XX v1.XX-fixes If rclone needs a point release due to some horrendous bug:
First make the release branch. If this is a second point release then
this will be done already.
* BASE_TAG=v1.XX # eg v1.49
* NEW_TAG=${BASE_TAG}.Y # eg v1.49.1
* echo $BASE_TAG $NEW_TAG # v1.49 v1.49.1
* git branch ${BASE_TAG} ${BASE_TAG}-fixes
Now
* git co ${BASE_TAG}-fixes
* git cherry-pick any fixes * git cherry-pick any fixes
* Test (see above) * Test (see above)
* make NEW_TAG=v1.XX.1 tag * make NEW_TAG=v1.XX.1 tag
* edit docs/content/changelog.md * edit docs/content/changelog.md
* make TAG=v1.43.1 doc * make TAG=${NEW_TAG} doc
* git commit -a -v -m "Version v1.XX.1" * git commit -a -v -m "Version ${NEW_TAG}"
* git tag -d -v1.XX.1 * git tag -d ${NEW_TAG}
* git tag -s -m "Version v1.XX.1" v1.XX.1 * git tag -s -m "Version ${NEW_TAG}" ${NEW_TAG}
* git push --tags -u origin v1.XX-fixes * git push --tags -u origin ${BASE_TAG}-fixes
* make BRANCH_PATH= TAG=v1.43.1 fetch_binaries * Wait for builds to complete
* make TAG=v1.43.1 tarball * make BRANCH_PATH= TAG=${NEW_TAG} fetch_binaries
* make TAG=v1.43.1 sign_upload * make TAG=${NEW_TAG} tarball
* make TAG=v1.43.1 check_sign * make TAG=${NEW_TAG} sign_upload
* make TAG=v1.43.1 upload * make TAG=${NEW_TAG} check_sign
* make TAG=v1.43.1 upload_website * make TAG=${NEW_TAG} upload
* make TAG=v1.43.1 upload_github * make TAG=${NEW_TAG} upload_website
* NB this overwrites the current beta so after the release, rebuild the last travis build * make TAG=${NEW_TAG} upload_github
* NB this overwrites the current beta so we need to do this
* git co master
* make LAST_TAG=${NEW_TAG} startdev
* # cherry pick the changes to the changelog and VERSION
* git checkout ${BASE_TAG}-fixes VERSION docs/content/changelog.md
* git commit --amend
* git push
* Announce! * Announce!
## Making a manual build of docker ## Making a manual build of docker

1
VERSION Normal file
View file

@ -0,0 +1 @@
v1.49.3