Skip to content

Commit

Permalink
Use GitHub actions to build and publish releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ningit committed Feb 3, 2020
1 parent 1886f02 commit 346aa38
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Generate assets
run: |
go generate
- name: Build for Linux
run: |
go build -ldflags="-s -w" -v .
tar -c smcview | gzip --best > smcview-linux64.tar.gz
- name: Build for Mac
run: |
go build -ldflags="-s -w" -v .
tar -c smcview | gzip --best > smcview-darwin64.tar.gz
env:
GOOS: darwin
GOARCH: amd64

- name: Build for Windows
run: |
go build -ldflags="-s -w" -v
zip smcview-windows64.zip smcview.exe
env:
GOOS: windows
GOARCH: amd64

- name: Create release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: Compiled binaries for Linux, Mac and Windows.
draft: false
prerelease: false

- name: Upload for Linux
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./smcview-linux64.tar.gz
asset_name: smcview-linux64.tar.gz
asset_content_type: application/gzip

- name: Upload for Mac
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./smcview-darwin64.tar.gz
asset_name: smcview-darwin64.tar.gz
asset_content_type: application/gzip

- name: Upload for Windows
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./smcview-windows64.zip
asset_name: smcview-windows64.zip
asset_content_type: application/zip

0 comments on commit 346aa38

Please sign in to comment.