Release #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
release: | |
name: 'Build, package and release to GitHub' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: ubuntu-latest | |
GOOS: linux | |
GOARCH: amd64 | |
- platform: ubuntu-latest | |
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 }} | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.23 | |
cache: false | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- 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 | |
- name: Prepare | |
run: | | |
mkdir -p dist/ && cd dist/ | |
cp ../config.default.yml config.yml | |
- name: Build | |
working-directory: ./dist | |
shell: bash | |
run: | | |
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 | |
- name: Compress working folder | |
working-directory: ./dist | |
if: "${{ matrix.GOOS != 'windows' }}" | |
run: | | |
zip -9 wakapi_${{ matrix.GOOS }}_${{ matrix.GOARCH }}.zip * | |
- name: Upload built executable to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./dist/*.zip | |
- name: Delete old releases | |
uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 10 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |