Skip to content

Commit 24965bb

Browse files
Merge pull request #393 from benluddy/version-from-tag
Embed version at link time based on git tags instead of a file.
2 parents 476040b + 88b4883 commit 24965bb

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
99

1010
WORKDIR /src
1111

12-
COPY OPM_VERSION OPM_VERSION
1312
COPY vendor vendor
1413
COPY cmd cmd
1514
COPY pkg pkg

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ CMDS := $(addprefix bin/, $(shell ls ./cmd | grep -v opm))
33
OPM := $(addprefix bin/, opm)
44
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
55
PKG := github.com/operator-framework/operator-registry
6-
GIT_COMMIT := $(shell git rev-parse --short HEAD)
7-
OPM_VERSION := $(shell cat OPM_VERSION)
6+
GIT_COMMIT := $(or $(SOURCE_GIT_COMMIT),$(shell git rev-parse --short HEAD))
7+
OPM_VERSION := $(or $(SOURCE_GIT_TAG),$(shell git describe --always --tags HEAD))
88
BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
99
TAGS := -tags "json1"
1010
# -race is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64

OPM_VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/contributors/releases.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,12 @@
44

55
Releases of opm are built by travis, see the [travis.yml](../../.travis.yml) for details.
66

7-
opm follows semantic versioning, with the latest version in the OPM_VERSION file at the top-level of the operator-registry repository.
8-
7+
opm follows semantic versioning, with the latest version derived from the newest semver tag.
98

109
## Triggering a release
1110

12-
1311
Releases are triggered via tags. Make a new release by tagging a commit with an appropriate semver tag.
1412

15-
Be sure to set the version in the OPM_VERSION file to reflect the new semver tag of opm before cutting the release. This ensures users
16-
can accurately check which version of opm they are using via the `opm version` command.
17-
1813
## Checking the build
1914

2015
Builds for a release can be found [on travis](https://travis-ci.com/operator-framework/operator-registry). After triggering a build, watch for logs. If the build is successful, a new [release](https://github.com/operator-framework/operator-registry) should appear in GitHub.
@@ -44,4 +39,4 @@ $ travis setup releases -r operator-framework/operator-registry --force --pro
4439
When prompted, enter credentials for the of-deploy-robot account. Copy the api key from the newly generated `deploy` section in .travis.yml, place
4540
it in the right place in the actual deploy config, and delete the generated deploy section.
4641

47-
You mean need to `travis login --pro` first.
42+
You mean need to `travis login --pro` first.

0 commit comments

Comments
 (0)