Skip to content

Commit

Permalink
Support release via GitHub action (#1)
Browse files Browse the repository at this point in the history
* Support release via GitHub action

* Avoid across compile
  • Loading branch information
LinuxSuRen committed Nov 18, 2021
1 parent e4a2720 commit 36b7900
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter
name-template: 'v$NEXT_PATCH_VERSION 🌈'
tag-template: 'v$NEXT_PATCH_VERSION'
version-template: $MAJOR.$MINOR.$PATCH
# Emoji reference: https://gitmoji.carloscuesta.me/
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- 'kind/feature'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- 'regression'
- 'kind/bug'
- title: 📝 Documentation updates
labels:
- documentation
- 'kind/doc'
- title: 👻 Maintenance
labels:
- chore
- dependencies
- 'kind/chore'
- 'kind/dep'
- title: 🚦 Tests
labels:
- test
- tests
exclude-labels:
- reverted
- no-changelog
- skip-changelog
- invalid
change-template: '* $TITLE (#$NUMBER) @$AUTHOR'
template: |
## What’s Changed
$CHANGES
54 changes: 54 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Pull Request Build

on:
pull_request:
branches:
- master

jobs:
build:
name: BuildOnLinux
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.16
uses: actions/[email protected]
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Build
run: |
sudo apt-get update -y
sudo apt install libasound2-dev -y
go build -o bin/goplay .
build-darwin:
name: BuildOnDarwin
runs-on: macos-10.15
steps:
- name: Set up Go 1.16
uses: actions/[email protected]
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Build
run: |
go build -o bin/goplay .
build-win:
name: BuildOnWindows
runs-on: windows-2019
steps:
- name: Set up Go 1.16
uses: actions/[email protected]
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Build
run: |
go build -o bin/goplay .
14 changes: 14 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Drafter

on:
push:
branches:
- master

jobs:
UpdateReleaseDraft:
runs-on: ubuntu-20.04
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
45 changes: 45 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
push:
tags:
- '*'

jobs:
BuildOnLinux:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.16.x
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
run: |
sudo apt-get update -y
sudo apt install libasound2-dev -y
GOENABLE=0 go build -o bin/goplay .
cd bin && tar czvf goplay-linux-amd64.tar.gz goplay
gh release upload ${{ github.ref_name }} goplay-linux-amd64.tar.gz
BuildOnDarwin:
runs-on: macos-10.15
steps:
- name: Set up Go 1.16
uses: actions/[email protected]
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
run: |
GOENABLE=0 go build -o bin/goplay .
cd bin && tar czvf goplay-darwin-amd64.tar.gz goplay
gh release upload ${{ github.ref_name }} goplay-darwin-amd64.tar.gz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
# Dependency directories (remove the comment below to include it)
# vendor/
goplay
bin/

0 comments on commit 36b7900

Please sign in to comment.