1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00
wakapi/.github/workflows/release.yml

78 lines
2.0 KiB
YAML
Raw Normal View History

2022-05-19 08:06:11 +03:00
name: Release
2020-05-31 11:29:15 +03:00
on:
release:
types:
- published
2020-05-31 11:29:15 +03:00
jobs:
release:
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:
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:
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
- 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
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' ../
- name: Compress working folder (Windows PowerShell)
working-directory: ./dist
if: "${{ matrix.GOOS == 'windows' }}"
run: |
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
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
- name: Upload built executable to Release
uses: softprops/action-gh-release@v1
2022-09-06 13:41:04 +03:00
with:
files: ./dist/*.zip