Skip to content

Commit

Permalink
Add release step to GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
samherrmann committed Aug 31, 2020
1 parent d5a69f0 commit 34dde33
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- master
tags:
- 'v*.*.*'
pull_request:
branches:
- master
Expand Down Expand Up @@ -32,3 +34,13 @@ jobs:

- name: Build
run: make build

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/*.tar.gz
dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

gobuild = mkdir -p dist/$$GOOS-$$GOARCH && go build -o dist/$$GOOS-$$GOARCH
tar = (cd dist && tar -czvf $$GOOS-$$GOARCH.tar.gz $$GOOS-$$GOARCH/*)
zip = (cd dist && zip -r $$GOOS-$$GOARCH.zip $$GOOS-$$GOARCH/*)

build:
export GOOS=linux; export GOARCH=386; $(gobuild)
export GOOS=linux; export GOARCH=amd64; $(gobuild)
export GOOS=windows; export GOARCH=amd64; $(gobuild)
export GOOS=windows; export GOARCH=386; $(gobuild)
export GOOS=linux; export GOARCH=386; $(gobuild) && $(tar)
export GOOS=linux; export GOARCH=amd64; $(gobuild) && $(tar)
export GOOS=windows; export GOARCH=amd64; $(gobuild) && $(zip)
export GOOS=windows; export GOARCH=386; $(gobuild) && $(zip)

test:
go test ./...
Expand Down

0 comments on commit 34dde33

Please sign in to comment.