Skip to content

Commit

Permalink
Merge pull request #15 from OpenSourceProjects/goreleaser
Browse files Browse the repository at this point in the history
Goreleaser
  • Loading branch information
dcoker authored Oct 20, 2021
2 parents 7e52515 + 8a1c22f commit 682b1eb
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 40 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
release:
types:
- published

name: Release

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.17

- name: Checkout code
uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: |
go mod download
go mod tidy -v
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ Temporary Items
/*.yml
/*.yaml

build_docker_cross
!/.goreleaser.yml
37 changes: 37 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
before:
hooks:
- go mod tidy
builds:
-
binary: biscuit
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
- 386
ldflags:
- -s -w
- -X main.Version={{.Version}}
universal_binaries:
- replace: false
archives:
-
name_template: "{{.ProjectName}}_{{.Version}}_{{.Os}}-{{.Arch}}"
replacements:
darwin: MacOS
linux: Linux
windows: Windows
amd64: 64bit
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
9 changes: 0 additions & 9 deletions Dockerfile.e2e

This file was deleted.

31 changes: 10 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ GOFLAGS := -v
PKG := ./...
TESTS := ".*"
GOIMPORTS := goimports
PROGNAME := biscuit
VERSION := $(shell git describe --long --tags --always)
GOVERSIONLDFLAG := -ldflags="-X main.Version=$(VERSION)"
VERSION ?= $(shell git describe --long --tags --always)

.PHONY: build
$(GO) install $(GOVERSIONLDFLAG) $(GOFLAGS)
Expand All @@ -32,24 +30,15 @@ clean:
rm -f $(GOPATH)/bin/$(PROGNAME)
$(GO) clean $(GOFLAGS) -i $(PKG)

.PHONY: cross
cross:
gox $(GOVERSIONLDFLAG) \
-output 'build/{{.Dir}}/{{.OS}}_{{.Arch}}/biscuit' \
-os "linux darwin windows" \
-arch "amd64 arm arm64 386" \
-osarch '!darwin/arm !darwin/386 !darwin/arm64'
./cross.sh

.PHONY: docker-build
docker-build:
docker build -f Dockerfile.e2e -t $(PROGNAME)/local .

.PHONY: docker-cross
docker-cross: docker-build
mkdir build_docker_cross || /bin/true
docker run -v $(shell pwd)/build_docker_cross/:/tmp/build/ $(PROGNAME)/local /bin/bash -xe -c \
"rm -f build && ln -s /tmp/build/ build && make cross"
.PHONY: goreleaser-test
goreleaser-test:
git tag ${VERSION}
docker run --rm \
-v $(shell pwd):/go/src/github.com/dcoker/biscuit \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/dcoker/biscuit \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
goreleaser/goreleaser release --rm-dist --snapshot


.PHONY: localstack
Expand Down
9 changes: 0 additions & 9 deletions cross.sh

This file was deleted.

0 comments on commit 682b1eb

Please sign in to comment.