Skip to content

Commit d5bd840

Browse files
committed
Add releaser
1 parent 9f19762 commit d5bd840

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.github/workflows/release.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 1
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.15
20+
- name: Run GoReleaser
21+
uses: goreleaser/goreleaser-action@v2
22+
with:
23+
version: latest
24+
args: release --rm-dist
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
project_name: gitsu
2+
3+
env:
4+
- GO111MODULE=on
5+
6+
before:
7+
hooks:
8+
- go mod tidy
9+
10+
builds:
11+
- main: .
12+
binary: git-su
13+
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
14+
15+
archives:
16+
- replacements:
17+
darwin: darwin
18+
linux: linux
19+
windows: windows
20+
amd64: x86_64
21+
22+
release:
23+
prerelease: auto

main.go

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ Author:
2424

2525
var (
2626
isGlobal = flag.Bool("global", false, "Set user as global")
27+
28+
// these are set in build step
29+
version = "unversioned"
30+
commit = "?"
31+
date = "?"
2732
)
2833

2934
func main() {

0 commit comments

Comments
 (0)