2022-05-19 08:06:11 +03:00
|
|
|
name: Release
|
2020-05-31 11:29:15 +03:00
|
|
|
|
|
|
|
on:
|
2022-09-30 15:43:43 +03:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- 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:
|
2022-09-06 13:41:04 +03:00
|
|
|
fail-fast: false
|
2022-05-19 08:06:11 +03:00
|
|
|
matrix:
|
2022-09-08 10:51:26 +03:00
|
|
|
include:
|
|
|
|
- platform: ubuntu-18.04
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: amd64
|
|
|
|
- platform: ubuntu-18.04
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: arm64
|
|
|
|
- platform: windows-latest
|
|
|
|
GOOS: windows
|
|
|
|
GOARCH: amd64
|
|
|
|
- platform: macos-latest
|
|
|
|
GOOS: darwin
|
|
|
|
GOARCH: amd64
|
|
|
|
- platform: macos-latest
|
|
|
|
GOOS: darwin
|
|
|
|
GOARCH: arm64
|
|
|
|
runs-on: ${{ matrix.platform }}
|
2022-09-06 13:16:22 +03:00
|
|
|
|
2020-05-31 11:29:15 +03:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Set up Go 1.x
|
2023-02-11 05:21:26 +03:00
|
|
|
uses: actions/setup-go@v3
|
2020-05-31 11:29:15 +03:00
|
|
|
with:
|
2022-12-03 02:32:30 +03:00
|
|
|
go-version: ^1.19
|
2020-05-31 11:29:15 +03:00
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
2023-02-11 05:21:26 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-05-31 11:29:15 +03:00
|
|
|
|
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
|
|
|
|
|
2022-09-06 13:16:22 +03:00
|
|
|
- name: Prepare
|
|
|
|
run: |
|
|
|
|
mkdir -p dist/ && cd dist/
|
|
|
|
cp ../config.default.yml config.yml
|
2022-05-19 08:09:50 +03:00
|
|
|
|
2020-05-31 11:29:15 +03:00
|
|
|
- name: Build
|
2022-09-06 13:16:22 +03:00
|
|
|
working-directory: ./dist
|
2022-09-08 10:51:26 +03:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-09-30 15:35:03 +03:00
|
|
|
GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} CGO_ENABLED=0 \
|
|
|
|
go build -v -ldflags '-w -s' ../
|
2022-09-08 10:51:26 +03:00
|
|
|
|
|
|
|
- name: Compress working folder (Windows PowerShell)
|
|
|
|
working-directory: ./dist
|
|
|
|
if: "${{ matrix.GOOS == 'windows' }}"
|
2021-01-24 13:42:12 +03:00
|
|
|
run: |
|
2022-09-08 10:51:26 +03:00
|
|
|
Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath wakapi_${{ matrix.GOOS }}_${{ matrix.GOARCH }}.zip
|
2022-09-06 13:16:22 +03:00
|
|
|
|
|
|
|
- name: Compress working folder
|
|
|
|
working-directory: ./dist
|
2022-09-08 10:51:26 +03:00
|
|
|
if: "${{ matrix.GOOS != 'windows' }}"
|
2022-05-19 08:06:11 +03:00
|
|
|
run: |
|
2022-09-06 13:16:22 +03:00
|
|
|
zip -9 wakapi_${{ matrix.GOOS }}_${{ matrix.GOARCH }}.zip *
|
2020-05-31 11:29:15 +03:00
|
|
|
|
2022-09-30 15:43:43 +03:00
|
|
|
- name: Upload built executable to Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
2022-09-06 13:41:04 +03:00
|
|
|
with:
|
2022-09-30 15:43:43 +03:00
|
|
|
files: ./dist/*.zip
|