Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,19 @@
GIT_VERSION ?= $(shell git log -1 --format="%h")
RELEASE_TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
RELEASE_VERSION ?= $(shell cat VERSION)
IS_NEW_RELEASE ?= true

# are there uncommitted files?
ifneq ($(shell git status --porcelain),)
# next is used by GoReleaser as well when --spanshot is set
RELEASE_TAG := $(RELEASE_TAG)-next
RELEASE_VERSION := $(RELEASE_VERSION)-dirty
IS_NEW_RELEASE := false
endif

# do we consider this to be a valid new release? Or are we working going forward?
ifneq ($(shell git branch --show-current),master)
RELEASE_VERSION := $(RELEASE_VERSION)-next
IS_NEW_RELEASE := false
else
ifeq ($(shell git diff HEAD~1 VERSION),)
RELEASE_VERSION := $(RELEASE_VERSION)-next
IS_NEW_RELEASE := false
endif
endif
# this is being kept, as in the future, we may check the diff of VERSION from the previous to determine
# whether or not to cut a release, rather than relying on git tags
#ifeq ($(shell git diff HEAD~1 VERSION),)
# RELEASE_VERSION := $(RELEASE_VERSION)-next
#endif

VERSION ?= $(RELEASE_VERSION)

Expand Down Expand Up @@ -310,9 +303,6 @@ $(MANAGERLESS_DIR) $(MANAGERLESS_BASE):

.PHONY: semver release-clusterctl release-manifests release $(RELEASE_CLUSTERCTLYAML) $(RELEASE_MANIFEST) $(RELEASE_METADATA) $(RELEASE_CLUSTER_TEMPLATE) $(FULL_RELEASE_CLUSTERCTLYAML)

check-release:
@echo $(IS_NEW_RELEASE)

semver:
ifeq (,$(VERSION))
$(error could not determine version to use from file, will not create artifacts)
Expand Down
12 changes: 1 addition & 11 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,8 @@ When building the manifests via `make manifests`, `make managerless`, or `make r

* Take the version from the contents of [VERSION](./VERSION)
* If there are any uncommitted files, append `-dirty`
* If not on `master` branch, or if on `master` branch but the [VERSION](./VERSION) file is unchanged from the last commit on `master` branch, append `-next`

The net of the above, is that the version will be treated as "clean" only when all of the following are true:

* there are no "dirty" uncommitted files
* the current commit is on `master` branch
* the `VERSION` is different from the previous commit

Thie encourages - requires - changes to a version, and therefore a release, to consist entirely of a single commit or merge to master,
whose entire change is the `VERSION` file and, optionally, in the same commit, the `APIVERSION` file.

To see what version you would get, run `make semver`. To see if this is a new release, run `make check-release`.
To see what version you would get, run `make semver`.

We are aware that this is a somewhat duplicative process, but there is no other way, as multiple stages
depend on having the versions in checked-in files and do not support environment variable or command-line
Expand Down