diff --git a/Makefile b/Makefile index cf9e7b378..587eb31ae 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,29 @@ 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)) +# 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) -ifeq ($(BRANCH),$(LAST_TAG)) +# If we are working on a release, override branch to master +ifdef RELEASE_TAG BRANCH := master endif TAG_BRANCH := -$(BRANCH) BRANCH_PATH := branch/ +# If building HEAD or master then unset TAG_BRANCH and BRANCH_PATH ifeq ($(subst HEAD,,$(subst master,,$(BRANCH))),) TAG_BRANCH := BRANCH_PATH := endif -TAG := $(shell echo $$(git describe --abbrev=8 --tags | sed 's/-\([0-9]\)-/-00\1-/; s/-\([0-9][0-9]\)-/-0\1-/'))$(TAG_BRANCH) -NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f.0", $$_)') -ifneq ($(TAG),$(LAST_TAG)) +# Make version suffix -DDD-gCCCCCCCC (D=commits since last relase, C=Commit) or blank +VERSION_SUFFIX := $(shell git describe --abbrev=8 --tags | perl -lpe 's/^v\d+\.\d+\.\d+//; s/^-(\d+)/"-".sprintf("%03d",$$1)/e;') +# 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 endif GO_VERSION := $(shell go version) @@ -44,8 +55,8 @@ vars: @echo SHELL="'$(SHELL)'" @echo BRANCH="'$(BRANCH)'" @echo TAG="'$(TAG)'" - @echo LAST_TAG="'$(LAST_TAG)'" - @echo NEW_TAG="'$(NEW_TAG)'" + @echo VERSION="'$(VERSION)'" + @echo NEXT_VERSION="'$(NEXT_VERSION)'" @echo GO_VERSION="'$(GO_VERSION)'" @echo BETA_URL="'$(BETA_URL)'" @@ -192,24 +203,25 @@ serve: website cd docs && hugo server -v -w tag: doc - @echo "Old tag is $(LAST_TAG)" - @echo "New tag is $(NEW_TAG)" - echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEW_TAG)\"\n" | gofmt > fs/version.go - echo -n "$(NEW_TAG)" > docs/layouts/partials/version.html - git tag -s -m "Version $(NEW_TAG)" $(NEW_TAG) - bin/make_changelog.py $(LAST_TAG) $(NEW_TAG) > docs/content/changelog.md.new + @echo "Old tag is $(VERSION)" + @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 @echo "Edit the new changelog in docs/content/changelog.md" @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" retag: - git tag -f -s -m "Version $(LAST_TAG)" $(LAST_TAG) + git tag -f -s -m "Version $(VERSION)" $(VERSION) startdev: - echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(LAST_TAG)-DEV\"\n" | gofmt > fs/version.go - git commit -m "Start $(LAST_TAG)-DEV development" 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 $(VERSION)-DEV development" fs/version.go winzip: zip -9 rclone-$(TAG).zip rclone.exe diff --git a/RELEASE.md b/RELEASE.md index f32210b66..04886189e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -48,26 +48,45 @@ Can be fixed with * GO111MODULE=on go mod vendor -Making a point release. If rclone needs a point release due to some -horrendous bug, then - * git branch v1.XX v1.XX-fixes +## Making a point release + +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 * Test (see above) * make NEW_TAG=v1.XX.1 tag * edit docs/content/changelog.md - * make TAG=v1.43.1 doc - * git commit -a -v -m "Version v1.XX.1" - * git tag -d -v1.XX.1 - * git tag -s -m "Version v1.XX.1" v1.XX.1 - * git push --tags -u origin v1.XX-fixes - * make BRANCH_PATH= TAG=v1.43.1 fetch_binaries - * make TAG=v1.43.1 tarball - * make TAG=v1.43.1 sign_upload - * make TAG=v1.43.1 check_sign - * make TAG=v1.43.1 upload - * make TAG=v1.43.1 upload_website - * make TAG=v1.43.1 upload_github - * NB this overwrites the current beta so after the release, rebuild the last travis build + * make TAG=${NEW_TAG} doc + * git commit -a -v -m "Version ${NEW_TAG}" + * git tag -d ${NEW_TAG} + * git tag -s -m "Version ${NEW_TAG}" ${NEW_TAG} + * git push --tags -u origin ${BASE_TAG}-fixes + * Wait for builds to complete + * make BRANCH_PATH= TAG=${NEW_TAG} fetch_binaries + * make TAG=${NEW_TAG} tarball + * make TAG=${NEW_TAG} sign_upload + * make TAG=${NEW_TAG} check_sign + * make TAG=${NEW_TAG} upload + * make TAG=${NEW_TAG} upload_website + * 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! ## Making a manual build of docker diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..d16171d45 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v1.49.3