Skip to content

Commit 59f2f7e

Browse files
committed
Set up goreleaser
1 parent c8024ed commit 59f2f7e

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,10 @@ jobs:
2424
uses: actions/checkout@v2
2525

2626
- name: Generate releases
27-
run: make releases
28-
29-
- name: Create Release
30-
id: create_release
31-
uses: actions/create-release@v1
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
34-
with:
35-
tag_name: ${{ github.ref }}
36-
release_name: ${{ github.ref }}
37-
draft: false
38-
prerelease: false
39-
40-
- name: GitHub Release
41-
uses: softprops/action-gh-release@v1
42-
if: success()
27+
uses: goreleaser/goreleaser-action@v2
4328
with:
44-
draft: true
45-
files: |
46-
dist/asl_darwin-amd64
47-
dist/asl_linux-amd64
48-
dist/asl_windows-amd64
49-
name: ${{ github.ref }}
29+
version: latest
30+
args: release --rm-dist
5031
env:
5132
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
5233

Makefile

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
#!/usr/bin/make
22

33
.DEFAULT_GOAL := all
4-
PLATFORMS := linux/amd64 darwin/amd64 windows/amd64
5-
6-
LD_FLAGS := -ldflags "-X main.Version=`git describe --tags` -X main.BuildDate=`date -u +%Y-%m-%d_%H:%M:%S` -X main.GitHash=`git rev-parse HEAD`"
7-
8-
temp = $(subst /, ,$@)
9-
os = $(word 1, $(temp))
10-
arch = $(word 2, $(temp))
114

125
.PHONY: setup
136
setup:
147
@go install github.com/securego/gosec/v2/cmd/[email protected]
158
@go install github.com/golangci/golangci-lint/cmd/[email protected]
169

17-
GOFILES=$(shell find . -type f -name '*.go' -not -path "./.git/*")
18-
1910
.PHONY: lint
2011
lint:
2112
golangci-lint run
@@ -26,13 +17,7 @@ sec:
2617

2718
.PHONY: bin
2819
bin:
29-
go build -o ./dist/asl
30-
31-
.PHONY: releases
32-
releases: $(PLATFORMS)
33-
34-
$(PLATFORMS):
35-
GOOS=$(os) GOARCH=$(arch) go build $(LD_FLAGS) -o 'dist/asl_$(os)-$(arch)'
20+
@go build -o ./dist/asl
3621

3722
.PHONY: test
3823
test:

goreleaser.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
project_name: asl
2+
env:
3+
- GO111MODULE=on
4+
- GOPROXY=https://proxy.golang.org
5+
before:
6+
hooks:
7+
- go mod download
8+
builds:
9+
-
10+
binary: asl
11+
id: asl
12+
ldflags: "-X main.Version={{.Version}} -X main.BuildDate={{.Date}} -X main.GitHash={{.Commit}}"
13+
env:
14+
- CGO_ENABLED=0
15+
flags:
16+
- -buildmode
17+
- exe
18+
goos:
19+
- darwin
20+
- linux
21+
goarch:
22+
- amd64
23+
- arm64
24+
goarm:
25+
- 7
26+
archives:
27+
-
28+
id: asl
29+
format: binary
30+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
31+
replacements:
32+
darwin: Darwin
33+
linux: Linux
34+
amd64: x86_64

0 commit comments

Comments
 (0)