-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
015f54d
commit f491537
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
name: Build and Release | ||
|
||
jobs: | ||
|
||
release: | ||
name: 'Create Release from Tag' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.get_version.outputs.VERSION }} | ||
release_name: Release ${{ steps.get_version.outputs.VERSION }} | ||
draft: false | ||
prerelease: false | ||
|
||
build: | ||
name: 'Build and Upload Release Binary' | ||
runs-on: ubuntu-latest | ||
needs: release | ||
strategy: | ||
matrix: | ||
OSes: ['windows', 'darwin', 'linux'] | ||
arch: ['amd64'] | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@master | ||
|
||
- name: 'Setup Golang Environment' | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.16' | ||
|
||
- name: 'Build ${{ matrix.OSes }}-${{ matrix.arch }}' | ||
run: | | ||
GOOS=${{ matrix.OSes }} \ | ||
GOARCH=${{ matrix.arch }} \ | ||
go build -o ino_${{ matrix.OSes }}_${{ matrix.arch }} | ||
- name: 'Upload Release Assets' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.release.outputs.upload_url }} | ||
asset_path: ./ino_${{ matrix.OSes }}_${{ matrix.arch }} | ||
asset_name: ino_${{ matrix.OSes }}_${{ matrix.arch }} | ||
asset_content_type: application/octet-stream | ||
|