2022-05-19 08:06:11 +03:00
|
|
|
name: Release
|
2020-05-31 11:29:15 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
2021-01-24 13:42:12 +03:00
|
|
|
types:
|
2021-02-03 11:41:11 +03:00
|
|
|
- published
|
2020-05-31 11:29:15 +03:00
|
|
|
|
|
|
|
jobs:
|
2022-05-20 06:46:29 +03:00
|
|
|
release:
|
2022-05-20 10:34:54 +03:00
|
|
|
name: 'Build, package and release to GitHub'
|
|
|
|
|
2022-05-19 08:06:11 +03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
2022-05-19 09:12:00 +03:00
|
|
|
include:
|
|
|
|
- platform: ubuntu-latest
|
|
|
|
alias: linux
|
|
|
|
- platform: macos-latest
|
|
|
|
alias: mac
|
|
|
|
- platform: windows-latest
|
|
|
|
alias: win
|
2022-05-19 08:06:11 +03:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.platform }}
|
2020-05-31 11:29:15 +03:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Set up Go 1.x
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2022-03-20 18:39:38 +03:00
|
|
|
go-version: ^1.18
|
2020-05-31 11:29:15 +03:00
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2022-07-09 06:58:16 +03:00
|
|
|
- name: Set version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
(git describe --tags --exact-match \
|
|
|
|
|| git symbolic-ref -q --short HEAD \
|
|
|
|
|| git rev-parse --short HEAD) > version.txt 2> /dev/null
|
|
|
|
|
2020-05-31 11:29:15 +03:00
|
|
|
- name: Get dependencies
|
2022-05-20 06:46:29 +03:00
|
|
|
run: go get
|
2022-05-19 08:09:50 +03:00
|
|
|
|
2020-05-31 11:29:15 +03:00
|
|
|
- name: Build
|
|
|
|
run: go build -v .
|
2021-01-24 13:42:12 +03:00
|
|
|
|
2022-05-19 08:06:11 +03:00
|
|
|
- name: Compress working folder on Windows
|
|
|
|
if: runner.os == 'Windows'
|
2021-01-24 13:42:12 +03:00
|
|
|
run: |
|
|
|
|
cp .\config.default.yml .\config.yml
|
2022-05-20 07:01:34 +03:00
|
|
|
Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath wakapi_${{ matrix.alias }}_amd64.zip
|
2022-05-19 08:06:11 +03:00
|
|
|
- name: Compress working folder on Unix
|
2022-05-19 08:10:23 +03:00
|
|
|
if: runner.os != 'Windows'
|
2022-05-19 08:06:11 +03:00
|
|
|
run: |
|
|
|
|
cp config.default.yml config.yml
|
2022-05-20 07:01:34 +03:00
|
|
|
zip -9 wakapi_${{ matrix.alias }}_amd64.zip wakapi config.yml
|
2020-05-31 11:29:15 +03:00
|
|
|
|
|
|
|
- name: Upload built executable to Release
|
2022-05-20 06:46:29 +03:00
|
|
|
uses: softprops/action-gh-release@v1
|
2020-05-31 11:29:15 +03:00
|
|
|
with:
|
2022-05-20 06:46:29 +03:00
|
|
|
files: wakapi_${{ matrix.alias }}_amd64.zip
|