Awesome
About
A GitHub Action for xgo, a Golang CGO cross-compiler.
Usage
name: build
on:
push:
pull_request:
jobs:
xgo:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Build
uses: crazy-max/ghaction-xgo@v3
with:
xgo_version: latest
go_version: 1.21
dest: build
prefix: myapp
targets: windows/amd64,linux/amd64,linux/arm64,darwin/arm64
v: true
x: false
race: false
ldflags: -s -w
buildmode: default
trimpath: true
Customizing
inputs
The following inputs can be used as step.with
keys
Name | Type | Default | Description |
---|---|---|---|
xgo_version | String | latest | xgo version (e.g., v0.24.0 ) |
go_version | String | latest | Go release to use for cross compilation from those docker tags (e.g., 1.19 ) |
dest | String | build | Destination folder to put binaries in |
pkg | String | Sub-package to build if not root import | |
prefix | String | package name | Prefix to use for output naming |
targets | String | */* | Comma separated targets to build for (e.g. windows/amd64,linux/386 ) |
v | Bool | false | Prints the names of packages as they are compiled |
x | Bool | false | Prints the build commands as compilation progresses |
race | Bool | false | Enable data race detection |
tags | String | Comma separated list of build tags to consider satisfied during the build | |
ldflags | String | Arguments to pass on each go tool link invocation | |
buildmode | String | default | Indicates which kind of object file to build |
buildvcs | String | Whether to stamp binaries with version control information | |
trimpath | Bool | false | Remove all file system paths from the resulting executable |
working_dir | String | $GITHUB_WORKSPACE | Working directory |
Limitation
This action is only available for Linux virtual environments.
Contributing
Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub or by making a PayPal donation to ensure this journey continues indefinitely!
Thanks again for your support, it is much appreciated! :pray:
License
MIT. See LICENSE
for more details.