Skip to content

Commit

Permalink
Use version.go file for app versioning (#22)
Browse files Browse the repository at this point in the history
This is to make it easier to test the reproducible executables before
tagging a release - we can use a canary executable for QA testing.

Also made some minor README updates.

Bump version to 0.3.0
  • Loading branch information
syncom authored Sep 22, 2023
1 parent 0119f28 commit c9ddd82
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
gunzip -c ./r10e-build/r10edocker-linux-amd64.gz >r10edocker.tmp
chmod +x r10edocker.tmp
APP_VERSION="$(./r10edocker.tmp --version | rev | cut -f1 -d' ' | rev)"
if [ "$APP_VERSION" != "v$RELEASE_VERSION" ]; then
echo "This is not supposed to happen. There must be a versioning bug."
if [ "$APP_VERSION" != "$RELEASE_VERSION" ]; then
echo "error: app version must equal tagged release version"
exit 1
fi
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ build_dir := $(mkfile_dir)/build
r10e_build_dir := $(mkfile_dir)/r10e-build
GOOS ?= $(shell go version | awk '{print $$NF}' | cut -d/ -f1)
GOARCH ?= $(shell go version | awk '{print $$NF}' | cut -d/ -f2)
VERSION ?= $(shell git describe --tags --dirty --always)
bin := $(build_dir)/r10edocker-$(GOOS)-$(GOARCH)
# project_name must match that in config.json
project_name := go-r10e-docker
Expand All @@ -16,7 +15,11 @@ all: build

build:
mkdir -p $(build_dir)
CGO_ENABLED=0 go build -trimpath -ldflags "-X main.version=$(VERSION)" -o $(bin) $(mkfile_dir)
ifndef VERSION
CGO_ENABLED=0 go build -trimpath -o $(bin) $(mkfile_dir)
else
CGO_ENABLED=0 go build -trimpath -ldflags "-X main.ver=$(VERSION)" -o $(bin) $(mkfile_dir)
endif

r10e-build: build
cp $(bin) $(build_dir)/r10edocker
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# r10edocker: Reproducible Docker Container for Go Application
# r10edocker: Reproducible Docker Container for Go Applications

[![sanity checks](https://github.com/syncom/r10edocker/actions/workflows/sanity.yml/badge.svg)](https://github.com/syncom/r10edocker/actions/workflows/sanity.yml)

Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package main

import (
r10edocker "github.com/syncom/r10edocker/cmd/r10e-docker"
"github.com/syncom/r10edocker/version"
)

var version = "development"
var ver = version.Version

func main() {
r10edocker.Execute(version)
r10edocker.Execute(ver)
}
3 changes: 3 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package version

const Version = "0.3.0"

0 comments on commit c9ddd82

Please sign in to comment.