Skip to content

Commit

Permalink
add gorelease and workflows
Browse files Browse the repository at this point in the history
Signed-off-by: allan716 <[email protected]>
  • Loading branch information
allanpk716 committed Jul 28, 2022
1 parent 10a76ff commit 64790e3
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release

on:
push:
tags:
- v*.*.*
- v*.*-Beta*
workflow_dispatch:

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release -f .goreleaser.yml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75 changes: 75 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
project_name: go-protocol-detector

env:
- GO111MODULE=on

before:
hooks:
- go mod tidy
builds:
- id: linux-amd64-build
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
main: ./cmd/go-protocol-detector/main.go
ldflags:
- -s -w --extldflags "-static -fpic"

- id: linux-armv7-build
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- arm
goarm:
- 7
main: ./cmd/go-protocol-detector/main.go
ldflags:
- -s -w --extldflags "-static -fpic"

- id: linux-arm64-build
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- arm64
main: ./cmd/go-protocol-detector/main.go
ldflags:
- -s -w --extldflags "-static -fpic"

- id: windows-build
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- amd64
main: ./cmd/go-protocol-detector/main.go
ldflags:
- -s -w --extldflags "-static -fpic"

archives:
- id: archive
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
replacements:
darwin: Darwin
linux: Linux
windows: Windows
amd64: x86_64
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^TestData:"
- "^TestCode:"

0 comments on commit 64790e3

Please sign in to comment.