Skip to content

Commit 292a8f5

Browse files
committed
feat(release): add goreleaser release to binary
1 parent ccd36be commit 292a8f5

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

.github/workflows/build.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checking out repository
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: 1.x
21+
22+
- name: Cache Go modules
23+
uses: actions/cache@v2
24+
with:
25+
path: ~/go/pkg/mod
26+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-
29+
30+
- name: Run GoReleaser
31+
uses: goreleaser/goreleaser-action@v2
32+
with:
33+
version: latest
34+
args: release --rm-dist
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Build output
22
go-project
3+
dist
34

45
# Test binary, built with `go test -c`
56
*.test

.goreleaser.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
env:
2+
- GO111MODULE=on
3+
- GOPROXY=https://goproxy.io,direct
4+
5+
before:
6+
hooks:
7+
- go mod download
8+
9+
builds:
10+
- env:
11+
- CGO_ENABLED=0
12+
goos:
13+
- darwin
14+
- linux
15+
- windows
16+
goarch:
17+
- 386
18+
- amd64
19+
- arm
20+
- arm64
21+
ignore:
22+
- goos: darwin
23+
goarch: 386
24+
ldflags:
25+
- -w -X github.com/zackijack/go-project/internal/version.Version={{ .Version }} -X github.com/zackijack/go-project/internal/version.GitCommit={{ .Commit }} -X github.com/zackijack/go-project/internal/version.BuildDate={{ .Date }}
26+
27+
archives:
28+
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
29+
replacements:
30+
darwin: Darwin
31+
linux: Linux
32+
windows: Windows
33+
386: i386
34+
amd64: x86_64
35+
format_overrides:
36+
- goos: windows
37+
format: zip
38+
39+
checksum:
40+
name_template: "{{ .ProjectName }}_checksums.txt"
41+
42+
snapshot:
43+
name_template: "{{ .Tag }}-{{.ShortCommit}}"
44+
45+
changelog:
46+
sort: asc
47+
filters:
48+
exclude:
49+
- "^docs:"
50+
- "^test:"
51+
- Merge pull request
52+
- Merge branch
53+
- go mod tidy

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
# go-project
22
Go project template
3+
4+
## Install
5+
You can install the pre-compiled binary in several different ways.
6+
7+
#### go get
8+
```shell
9+
$ go get github.com/zackijack/go-project
10+
```
11+
and ensuring that `$GOPATH/bin` is added to your `$PATH`.
12+
13+
#### manually
14+
Download the pre-compiled binaries from the [releases page](https://github.com/zackijack/go-project/releases) and copy to the desired location.

0 commit comments

Comments
 (0)