fix(ci): actions release, build on push/pr

This commit is contained in:
Steven Tang 2021-01-24 21:42:12 +11:00
parent 1f44ccadba
commit 42a6e9d923
No known key found for this signature in database
GPG Key ID: AA0C5A4496B7ADF5
2 changed files with 28 additions and 15 deletions

View File

@ -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 }}

View File

@ -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 }}