Skip to content

Commit 10c929d

Browse files
Merge pull request #7 from salesforce/goreleaser-docker-fix
Add goreleaser to workflows/ci.yaml
2 parents 8fb4830 + 528beda commit 10c929d

File tree

6 files changed

+25
-8
lines changed

6 files changed

+25
-8
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,23 @@ jobs:
1818
- name: checkout
1919
uses: actions/checkout@master
2020
with:
21-
ref: ${{ github.ref }}
21+
fetch-depth: 0
2222
- name: Set up Go
2323
uses: actions/setup-go@v2
2424
with:
2525
go-version: 1.17
26+
- name: Cache Go modules
27+
uses: actions/cache@v2
28+
with:
29+
path: ~/go/pkg/mod
30+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-
2633
- name: build and test binary
2734
run: make ci
28-
- name: docker build
29-
run: make local-docker-build
35+
- name: GoReleaser Build
36+
uses: goreleaser/goreleaser-action@v2
37+
with:
38+
distribution: goreleaser
39+
version: latest
40+
args: release --skip-publish --snapshot --rm-dist

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ jobs:
2121
uses: actions/setup-go@v2
2222
with:
2323
go-version: 1.17
24+
- name: Cache Go modules
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/go/pkg/mod
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
2431
- name: Docker Login
2532
uses: docker/login-action@v1
2633
with:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
.idea
33

44
# Build / CI artifacts
5-
bin
5+
/ci-result-to-slack
66
coverage.out

.goreleaser.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ project_name: ci-result-to-slack
22
builds:
33
- env: [CGO_ENABLED=0]
44
main: ./cmd/ci-result-to-slack
5-
binary: bin/ci-result-to-slack
65
goos:
76
- linux
87
- windows

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM gcr.io/distroless/base-debian11
22

3-
COPY ./bin/ci-result-to-slack /ci-result-to-slack
3+
COPY ./ci-result-to-slack /ci-result-to-slack
44

55
ENTRYPOINT ["/ci-result-to-slack"]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci: build test
88

99
build: clean
1010
@echo "Building..."
11-
CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -o bin/$(BINARY_NAME) ./cmd/$(BINARY_NAME)/main.go
11+
CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -o $(BINARY_NAME) ./cmd/$(BINARY_NAME)/main.go
1212

1313
test: clean
1414
@echo "Running unit tests..."
@@ -23,7 +23,7 @@ lint:
2323

2424
clean:
2525
@echo "Cleaning..."
26-
rm -rf ./bin/$(BINARY_NAME)
26+
rm -rf .$(BINARY_NAME)
2727
rm -rf coverage.out
2828

2929
local-docker-test: ## Build and run unit tests in docker container like CI without building the container

0 commit comments

Comments
 (0)