-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from hitalos/master
Build config suggestion
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
release: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
artifact_name: ${{ github.event.repository.name }}-linux-amd64 | ||
install_deps: sudo apt update && sudo apt install -y libc6-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev libasound2-dev pkg-config | ||
env_vars: GOOS=linux GOARCH=amd64 | ||
- os: ubuntu-latest | ||
artifact_name: ${{ github.event.repository.name }}-windows-amd64.exe | ||
install_deps: "" | ||
env_vars: GOOS=windows GOARCH=amd64 CGO_ENABLED=0 | ||
build_args: -a -ldflags '-extldflags "-static" -s -w' | ||
- os: macos-latest | ||
artifact_name: ${{ github.event.repository.name }}-darwin-arm64 | ||
install_deps: "" | ||
env_vars: GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 | ||
build_args: -a -ldflags '-s -w' | ||
- os: macos-latest | ||
artifact_name: ${{ github.event.repository.name }}-darwin-amd64 | ||
install_deps: "" | ||
env_vars: GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 | ||
build_args: -a -ldflags '-s -w' | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: Install dependencies | ||
run: ${{ matrix.install_deps }} | ||
|
||
- name: Build | ||
run: ${{ matrix.env_vars }} go build ${{ matrix.build_args }} -o dist/${{ matrix.artifact_name }} | ||
|
||
- name: Compress binaries | ||
run: gzip dist/${{ matrix.artifact_name }} | ||
|
||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: dist/${{ matrix.artifact_name }}.gz | ||
asset_name: ${{ matrix.artifact_name }}.gz | ||
tag: ${{ github.ref }} |