Skip to content

Use goreleaser for release builds #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,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