wakapi/.github/workflows/release.yml

78 lines
1.8 KiB
YAML

name: Release
on:
push:
branches:
pull_request:
release:
types:
- published
jobs:
build-and-release:
name: Build & Release
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
include:
- platform: ubuntu-latest
alias: linux
- platform: macos-latest
alias: mac
- platform: windows-latest
alias: win
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get
- name: Enable Go 1.11 modules
if: runner.os == 'Windows'
run: cmd /c "set GO111MODULE=on"
- name: Unit Tests
run: go test ./... -run ./...
- name: API Tests
run: |
npm -g install newman
./testing/run_api_tests.sh
- name: Build
run: go build -v .
- name: Compress working folder on Windows
if: runner.os == 'Windows'
run: |
cp .\config.default.yml .\config.yml
Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath release.zip
- name: Compress working folder on Unix
if: runner.os != 'Windows'
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 }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: release.zip
asset_name: wakapi_${{ matrix.alias }}_amd64.zip
asset_content_type: application/gzip