Skip to content

Commit

Permalink
Update build steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ribtoks committed Aug 28, 2024
1 parent 41c9045 commit 169575e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
- uses: actions/checkout@v3

- name: Build
env:
GIT_COMMIT: "${{ github.sha }}"
run: |
go get -d -v
go build -v .
make vendors
make build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.swp
bin/
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)

build:
export GOFLAGS="-mod=vendor"
go build
env GOFLAGS="-mod=vendor" CGO_ENABLED=0 go build -ldflags="-s -w -X main.GitCommit=$(GIT_COMMIT)" -o bin/github-tdg *.go

test:
go test ./...
env GOFLAGS="-mod=vendor" CGO_ENABLED=0 go test ./...

vendors:
go mod tidy
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import (
"golang.org/x/oauth2"
)

var (
GitCommit string
)

const (
defaultMinWords = 3
defaultMinChars = 30
Expand Down Expand Up @@ -533,6 +537,7 @@ func appendGitHubActionOutput() {

func main() {
log.SetOutput(os.Stdout)
log.Printf("Starting. version=%v", GitCommit)

env := environment()
ctx := context.Background()
Expand Down

0 comments on commit 169575e

Please sign in to comment.