Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Fix goreleaser action and add a version flag
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Young <ynick@vmware.com>
  • Loading branch information
Nick Young authored and youngnick committed Jan 6, 2020
1 parent f4de395 commit 4d72b84
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
-
name: Set up Go
uses: actions/setup-go@v1
# You have to specify a go version or you'll get 1.10
with:
go-version: 1.13.x
-
Expand All @@ -31,4 +32,10 @@ jobs:
version: latest
args: release
env:
# This is any token. By default Github Actions
# get an autogenerated GITHUB_TOKEN that gives repo
# privileges. The one below is a user token
# that has access to the ir2proxy repo and the
# homebrew-ir2proxy repo. This is required for using
# goreleaser for homebrew from an action.
GITHUB_TOKEN: ${{ secrets.IR2PROXYBOT_TOKEN }}
3 changes: 3 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ builds:
flags:
- -mod=readonly
- -v
# Sets the version to the goreleaser one.
ldflags:
- -X main.build={{.Version}}
goos:
- windows
- linux
Expand Down
12 changes: 3 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ SRCDIRS := ./cmd

TAG_LATEST ?= false

# Sets GIT_REF to a tag if it's present, otherwise the short rev.
GIT_REF = $(shell git describe --tags || git rev-parse --short=8 --verify HEAD)
VERSION ?= $(GIT_REF)
# Used for the tag-latest action.
# The tag-latest action will be a noop unless this is explicitly
# set outside this Makefile, as a safety valve.
LATEST_VERSION ?= NOLATEST
GIT_REF := $(shell git rev-parse --short=8 --verify HEAD)

export GO111MODULE=on

Expand All @@ -36,10 +30,10 @@ check: install $(Check_Targets) ## Run tests and CI checks
pedantic: check check-errcheck ## Run pedantic CI checks

install: ## Build and install the contour binary
go install -mod=readonly -v $(MODULE)/cmd/$(PROJECT)
go install -mod=readonly -v -ldflags="-X main.build=$(GIT_REF)" $(MODULE)/cmd/$(PROJECT)

race:
go install -mod=readonly -v $(MODULE)/cmd/$(PROJECT)
go install -mod=readonly -ldflags="-X main.build=$(GIT_REF)" g-v $(MODULE)/cmd/$(PROJECT)

download: ## Download Go modules
go mod download
Expand Down
4 changes: 3 additions & 1 deletion cmd/ir2proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
kingpin "gopkg.in/alecthomas/kingpin.v2"
)

var build = "devel"

func main() {

exitcode := run()
Expand All @@ -27,7 +29,7 @@ func run() int {

log := logrus.StandardLogger()
app := kingpin.New("ir2proxy", "Contour IngressRoute to HTTPProxy conversion tool.")

app.Version(build)
yamlfile := app.Arg("yaml", "YAML file to parse for IngressRoute objects").Required().ExistingFile()

args := os.Args[1:]
Expand Down

0 comments on commit 4d72b84

Please sign in to comment.