Skip to content

Commit f67a14d

Browse files
committed
golreleaser
1 parent ac2716a commit f67a14d

File tree

3 files changed

+111
-1
lines changed

3 files changed

+111
-1
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/[email protected]
14+
with:
15+
fetch-depth: 0
16+
- run: wget https://github.com/ProtobufBot/pbbot-react-ui/releases/latest/download/static.zip && unzip -o static.zip -d pkg/static/
17+
- name: Set up Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: '1.16.2'
21+
22+
- name: Run GoReleaser
23+
uses: goreleaser/goreleaser-action@v2
24+
with:
25+
version: latest
26+
args: release --rm-dist
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ captcha.jpg
4444
/releases
4545
/gmc_config.json
4646
cuberbot
47-
tmp
47+
tmp
48+
dist/

.goreleaser.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
env:
2+
- GO111MODULE=on
3+
before:
4+
hooks:
5+
- go mod tidy
6+
builds:
7+
- id: nowin
8+
main: ./service/gmc
9+
env:
10+
- CGO_ENABLED=0
11+
- GO111MODULE=on
12+
goos:
13+
- linux
14+
- darwin
15+
goarch:
16+
- 386
17+
- amd64
18+
- arm
19+
- arm64
20+
goarm:
21+
- 7
22+
ignore:
23+
- goos: darwin
24+
goarch: arm
25+
- goos: darwin
26+
goarch: 386
27+
mod_timestamp: "{{ .CommitTimestamp }}"
28+
flags:
29+
- -trimpath
30+
ldflags:
31+
- -s -w -extldflags '-static'
32+
hooks:
33+
post:
34+
- upx "{{ .Path }}"
35+
- id: win
36+
main: ./service/gmc_lorca
37+
env:
38+
- CGO_ENABLED=0
39+
- GO111MODULE=on
40+
goos:
41+
- windows
42+
goarch:
43+
- 386
44+
- amd64
45+
mod_timestamp: "{{ .CommitTimestamp }}"
46+
flags:
47+
- -trimpath
48+
ldflags:
49+
- -s -w -extldflags '-static' -H windowsgui
50+
hooks:
51+
post:
52+
- upx "{{ .Path }}"
53+
54+
checksum:
55+
name_template: "{{ .ProjectName }}_checksums.txt"
56+
changelog:
57+
skip: true
58+
archives:
59+
- id: binary
60+
builds:
61+
- win
62+
name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
63+
format_overrides:
64+
- goos: windows
65+
format: binary
66+
- id: nowin
67+
builds:
68+
- nowin
69+
- win
70+
name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
71+
format_overrides:
72+
- goos: windows
73+
format: zip
74+
75+
nfpms:
76+
- license: AGPL 3.0
77+
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
78+
formats:
79+
- deb
80+
- rpm
81+
maintainer: lz1998

0 commit comments

Comments
 (0)