build: change beta numbering to be semver compatible - Fixes #4516

From now on the betas will be numbered for the version that they will
become, so:

v1.53.0-beta.NNNN.CCCCC

Where N is commit number and C is commit. When released this will
become v1.53.0 and the beta will become v1.54.0-beta.NNN.CCCCC.

The commit number is the count of the commits since the root of the
tree since we can no longer use the the git version numbers since the
last tag.

This will simplify building the stable branch but that release
procedure hasn't been revised yet.

This commit also injects the name of the branch for the beta builds
into the download path.
This commit is contained in:
Nick Craig-Wood 2020-08-18 21:24:54 +01:00
parent 75d54d720c
commit e54ce35019
5 changed files with 38 additions and 27 deletions

View File

@ -7,24 +7,26 @@ RELEASE_TAG := $(shell git tag -l --points-at HEAD)
VERSION := $(shell cat VERSION) VERSION := $(shell cat VERSION)
# Last tag on this branch # Last tag on this branch
LAST_TAG := $(shell git describe --tags --abbrev=0) LAST_TAG := $(shell git describe --tags --abbrev=0)
# Next version
NEXT_VERSION := $(shell echo $(VERSION) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f.0", $$_)')
# If we are working on a release, override branch to master # If we are working on a release, override branch to master
ifdef RELEASE_TAG ifdef RELEASE_TAG
BRANCH := master BRANCH := master
LAST_TAG := $(shell git describe --abbrev=0 --tags $(VERSION)^)
endif endif
TAG_BRANCH := -$(BRANCH) TAG_BRANCH := .$(BRANCH)
BRANCH_PATH := branch/ BRANCH_PATH := branch/$(BRANCH)/
# If building HEAD or master then unset TAG_BRANCH and BRANCH_PATH # 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
# Make version suffix -DDD-gCCCCCCCC (D=commits since last relase, C=Commit) or blank # Make version suffix -beta.NNNN.CCCCCCCC (N=Commit number, C=Commit)
VERSION_SUFFIX := $(shell git describe --abbrev=8 --tags | perl -lpe 's/^v\d+\.\d+\.\d+//; s/^-(\d+)/"-".sprintf("%03d",$$1)/e;') VERSION_SUFFIX := -beta.$(shell git rev-list --count HEAD).$(shell git show --no-patch --no-notes --pretty='%h' HEAD)
# TAG is current version + number of commits since last release + branch # TAG is current version + commit number + commit + branch
TAG := $(VERSION)$(VERSION_SUFFIX)$(TAG_BRANCH) TAG := $(VERSION)$(VERSION_SUFFIX)$(TAG_BRANCH)
NEXT_VERSION := $(shell echo $(VERSION) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f.0", $$_)') ifdef RELEASE_TAG
ifndef RELEASE_TAG TAG := $(RELEASE_TAG)
TAG := $(TAG)-beta
endif endif
GO_VERSION := $(shell go version) GO_VERSION := $(shell go version)
ifdef BETA_SUBDIR ifdef BETA_SUBDIR
@ -56,7 +58,6 @@ vars:
@echo BRANCH="'$(BRANCH)'" @echo BRANCH="'$(BRANCH)'"
@echo TAG="'$(TAG)'" @echo TAG="'$(TAG)'"
@echo VERSION="'$(VERSION)'" @echo VERSION="'$(VERSION)'"
@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)'"
@ -220,25 +221,24 @@ fetch_binaries:
serve: website serve: website
cd docs && hugo server -v -w --disableFastRender cd docs && hugo server -v -w --disableFastRender
tag: doc tag: retag doc
@echo "Old tag is $(VERSION)" bin/make_changelog.py $(LAST_TAG) $(VERSION) > docs/content/changelog.md.new
@echo "New tag is $(NEXT_VERSION)"
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEXT_VERSION)\"\n" | gofmt > fs/version.go
echo -n "$(NEXT_VERSION)" > docs/layouts/partials/version.html
echo "$(NEXT_VERSION)" > VERSION
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 $(NEXT_VERSION)\" -a -v @echo git commit -m \"Version $(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:
@echo "Version is $(VERSION)"
git tag -f -s -m "Version $(VERSION)" $(VERSION) git tag -f -s -m "Version $(VERSION)" $(VERSION)
startdev: startdev:
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(VERSION)-DEV\"\n" | gofmt > fs/version.go @echo "Version is $(VERSION)"
@echo "Next version is $(NEXT_VERSION)"
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEXT_VERSION)-DEV\"\n" | gofmt > fs/version.go
echo -n "$(NEXT_VERSION)" > docs/layouts/partials/version.html
echo "$(NEXT_VERSION)" > VERSION
git commit -m "Start $(VERSION)-DEV development" fs/version.go git commit -m "Start $(VERSION)-DEV development" fs/version.go
winzip: winzip:

View File

@ -69,6 +69,8 @@ this will be done already.
Now Now
* FIXME this is now broken with new semver layout - needs fixing
* FIXME the TAG=${NEW_TAG} shouldn't be necessary any more
* git co ${BASE_TAG}-stable * git co ${BASE_TAG}-stable
* git cherry-pick any fixes * git cherry-pick any fixes
* Test (see above) * Test (see above)

View File

@ -1 +1 @@
v1.52.3 v1.53.0

View File

@ -38,16 +38,25 @@ Beta releases
[Beta releases](https://beta.rclone.org) are generated from each commit [Beta releases](https://beta.rclone.org) are generated from each commit
to master. Note these are named like to master. Note these are named like
{Version Tag}-{Commit Number}-g{Git Commit Hash} {Version Tag}.beta.{Commit Number}.{Git Commit Hash}
You can match the `Git Commit Hash` up with the [git eg
log](https://github.com/rclone/rclone/commits/master). The most recent
release will have the largest `Version Tag` and `Commit Number` and v1.53.0-beta.4677.b657a2204
will normally be at the end of the list.
The `Version Tag` is the version that the beta release will become
when it is released. You can match the `Git Commit Hash` up with the
[git log](https://github.com/rclone/rclone/commits/master). The most
recent release will have the largest `Version Tag` and `Commit Number`
and will normally be at the end of the list.
Some beta releases may have a branch name also: Some beta releases may have a branch name also:
{Version Tag}-{Commit Number}-g{Git Commit Hash}-{Branch Name} {Version Tag}-beta.{Commit Number}.{Git Commit Hash}.{Branch Name}
eg
v1.53.0-beta.4677.b657a2204.semver
The presence of `Branch Name` indicates that this is a feature under The presence of `Branch Name` indicates that this is a feature under
development which will at some point be merged into the normal betas development which will at some point be merged into the normal betas

View File

@ -1 +1 @@
v1.52.0 v1.53.0