From 36b7900a0dfb932b08cf6c2c453307b25059552e Mon Sep 17 00:00:00 2001 From: Rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Thu, 18 Nov 2021 16:48:26 +0800 Subject: [PATCH] Support release via GitHub action (#1) * Support release via GitHub action * Avoid across compile --- .github/release-drafter.yml | 42 +++++++++++++++++++++ .github/workflows/pull-request.yaml | 54 +++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 14 +++++++ .github/workflows/release.yaml | 45 ++++++++++++++++++++++ .gitignore | 1 + 5 files changed, 156 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/pull-request.yaml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/release.yaml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..8132458 --- /dev/null +++ b/.github/release-drafter.yml @@ -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 diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..b52084a --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -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/setup-go@v2.1.4 + with: + go-version: 1.16 + id: go + - name: Check out code into the Go module directory + uses: actions/checkout@v2.3.5 + - 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/setup-go@v2.1.4 + with: + go-version: 1.16 + id: go + - name: Check out code into the Go module directory + uses: actions/checkout@v2.3.5 + - 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/setup-go@v2.1.4 + with: + go-version: 1.16 + id: go + - name: Check out code into the Go module directory + uses: actions/checkout@v2.3.5 + - name: Build + run: | + go build -o bin/goplay . diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..73fcc4f --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -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 }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..bc430d5 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + BuildOnLinux: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2.3.5 + - name: Unshallow + run: git fetch --prune --unshallow + - name: Set up Go + uses: actions/setup-go@v2.1.4 + 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/setup-go@v2.1.4 + with: + go-version: 1.16 + id: go + - name: Check out code into the Go module directory + uses: actions/checkout@v2.3.5 + - 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 diff --git a/.gitignore b/.gitignore index fd9d047..80f288d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ # Dependency directories (remove the comment below to include it) # vendor/ goplay +bin/