Skip to content

Commit

Permalink
Merge pull request #195 from ilyesAj/change_build_to_goreleaser
Browse files Browse the repository at this point in the history
add goreleaser files && optimze size of binaries
  • Loading branch information
h3poteto authored Dec 28, 2022
2 parents 9443ce7 + 4c524df commit 533e822
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
- name: Make all
run: make all VERSION=${GITHUB_REF##*/}
- name: Upload release binaries
uses: alexellis/[email protected]
- name: install dependencies
run: go mod download
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: v1.11.5
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_paths: '["./bin/*"]'
37 changes: 37 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- windows
- linux
- darwin
goarch:
- amd64
- arm
- arm64
- '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

0 comments on commit 533e822

Please sign in to comment.