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

fix(build): enable cgo, downgrade release to ubuntu-18.04, add -w -s (#404)

* fix(build): releases with cgo
* build: downgrade to ubuntu-18.04
* build: add -w -s flags
This commit is contained in:
Steven Tang 2022-09-08 17:51:26 +10:00 committed by GitHub
parent 4c1f4ed39b
commit e399af1f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,12 +8,29 @@ on:
jobs:
release:
name: 'Build, package and release to GitHub'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
GOOS: [darwin, windows, linux]
GOARCH: [amd64, arm64]
include:
- platform: ubuntu-18.04
GOOS: linux
GOARCH: amd64
CC: gcc
- platform: ubuntu-18.04
package: gcc-aarch64-linux-gnu
GOOS: linux
GOARCH: arm64
CC: aarch64-linux-gnu-gcc
- 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:
@ -26,6 +43,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Install gcc
if: "${{ matrix.package != '' }}"
run: sudo apt-get update && sudo apt-get -y install ${{ matrix.package }}
- name: Set version
shell: bash
run: |
@ -40,11 +61,20 @@ jobs:
- name: Build
working-directory: ./dist
shell: bash
run: |
GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} go build -v ../
GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} \
CC=${{ matrix.CC }} CGO_ENABLED=1 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 *