Skip to content

Commit

Permalink
Use goreleaser for release builds (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh authored Mar 16, 2022
1 parent 17aea3c commit c55047c
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 83 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,10 @@ jobs:
- name: go test
run: go test ./...

- name: install gox
env:
GO111MODULE: off
run: go get github.com/mitchellh/gox

- name: cross build
shell: bash
run: |
export PATH=$PATH:$(go env GOPATH)/bin
mkdir -p build/bin
gox -ldflags '-X main.version=${{ github.sha }}' \
-output='build/bin/{{.Dir}}-{{.OS}}-{{.Arch}}' \
-os='windows linux darwin freebsd' \
-arch='amd64 386 arm arm64' \
-osarch='!darwin/386 !darwin/arm !darwin/arm64' ./cmd/gvm
-
name: cross build with goreleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: build --rm-dist --snapshot
30 changes: 30 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: goreleaser

on:
push:
tags:
- 'v*'

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:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67 changes: 0 additions & 67 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

**/gvm
!**/gvm/
build/
dist/
48 changes: 48 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---

builds:
- main: ./cmd/gvm
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'

universal_binaries:
- replace: false

archives:
- format: binary
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"

checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256

release:
draft: true
prerelease: auto
mode: append

changelog:
groups:
- title: Added
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: Fixed
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: Other
order: 999
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fixed builds under Go 1.18. [#46](https://github.com/andrewkroh/gvm/issues/46) [#47](https://github.com/andrewkroh/gvm/pull/47)
- Fixed several issues identified by golangci-lint. [#48](https://github.com/andrewkroh/gvm/pull/48)

### Added

- Added macos universal build and switched to goreleaser for release builds. [#50](https://github.com/andrewkroh/gvm/pull/50)

## [0.4.0]

### Added
Expand Down

0 comments on commit c55047c

Please sign in to comment.