Skip to content

Commit

Permalink
.version: add file to track tools versions
Browse files Browse the repository at this point in the history
- Single source of truth, used in CI and locally.
- Update gh actions to use versions from file
- Bump version of GoReleaser action

Fixes #23
Fixes #42
  • Loading branch information
mmatczuk committed Sep 14, 2022
1 parent 7bbe893 commit 022abbb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ jobs:
- name: "Check out code into the Go module directory"
uses: actions/checkout@v3

- name: Set version env variables
run: |
cat .version >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "${{env.GO_VERSION}}"

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.49.0
version: "${{env.GOLANGCI_LINT_VERSION}}"

- name: Run unit test
run: make test coverage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ jobs:
with:
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/

- name: Set version env variables
run: |
cat .version >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.17
id: go
go-version: "${{env.GO_VERSION}}"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: "${{env.GORELEASER_VERSION}}"
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create a token, comment above, and uncomment bellow if need to
# publish to an external repo (e.g.: Homebrew).
# GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GO_VERSION=1.19.1

GOLANGCI_LINT_VERSION=v1.49.0
GORELEASER_VERSION=v1.11.2
GODOC_VERSION=latest
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ all: dev
export GOBIN := $(PWD)/bin
export PATH := $(GOBIN):$(PATH)

include .version

.PHONY: install-dependencies
install-dependencies:
@rm -Rf bin && mkdir -p $(GOBIN)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/goreleaser/goreleaser@latest
go install golang.org/x/tools/cmd/godoc@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
go install github.com/goreleaser/goreleaser@$(GORELEASER_VERSION)
go install golang.org/x/tools/cmd/godoc@$(GODOC_VERSION)

.PHONY: dev
dev: forwarder.race
Expand Down

0 comments on commit 022abbb

Please sign in to comment.