From 42a6e9d9231041cace1de244b77db079c8766eda Mon Sep 17 00:00:00 2001 From: Steven Tang Date: Sun, 24 Jan 2021 21:42:12 +1100 Subject: [PATCH] fix(ci): actions release, build on push/pr --- .github/workflows/linux-build-on-release.yml | 23 ++++++++++++-------- .github/workflows/win-build-on-release.yml | 20 ++++++++++++----- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/linux-build-on-release.yml b/.github/workflows/linux-build-on-release.yml index 13a2bbc..73374cc 100644 --- a/.github/workflows/linux-build-on-release.yml +++ b/.github/workflows/linux-build-on-release.yml @@ -1,13 +1,15 @@ name: Build Wakapi on Linux on: + push: + pull_request: release: - types: + types: - created jobs: build-and-release: - name: Build and add to Release + name: Build runs-on: ubuntu-latest steps: @@ -22,18 +24,21 @@ jobs: - name: Get dependencies run: | - go get -v -t -d ./... - + go get github.com/markbates/pkger/cmd/pkger + go get + go generate + - name: Build run: GO111MODULE=on go build -v . - - name: Zip Release - uses: TheDoctor0/zip-release@v0.3.0 - with: - filename: release.zip - exclusions: '*.git*' + - name: Zip executable and sample config + if: github.event_name == 'release' + run: | + cp config.default.yml config.yml + zip -9 release.zip wakapi config.yml - name: Upload built executable to Release + if: github.event_name == 'release' uses: actions/upload-release-asset@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/win-build-on-release.yml b/.github/workflows/win-build-on-release.yml index 4c036d8..3d66edd 100644 --- a/.github/workflows/win-build-on-release.yml +++ b/.github/workflows/win-build-on-release.yml @@ -1,13 +1,15 @@ name: Build Wakapi on Windows on: + push: + pull_request: release: - types: + types: - created jobs: build-and-release: - name: Build and add to release + name: Build runs-on: windows-latest steps: @@ -22,18 +24,24 @@ jobs: - name: Get dependencies run: | - go get -v -t -d ./... + go get github.com/markbates/pkger/cmd/pkger + go get + go generate - name: Enable Go 1.11 modules run: cmd /c "set GO111MODULE=on" - + - name: Build run: go build -v . - + - name: Compress working folder - run: Compress-Archive -Path .\* -DestinationPath release.zip + if: github.event_name == 'release' + run: | + cp .\config.default.yml .\config.yml + Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath release.zip - name: Upload built executable to Release + if: github.event_name == 'release' uses: actions/upload-release-asset@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}