2024-11-28 10:17:43 +01:00
|
|
|
# Build Go Forgejo Action
|
|
|
|
|
|
|
|
|
|
This Action builds a Go application. It compiles the specified Go source file and outputs the build artifacts to a target directory.
|
|
|
|
|
|
|
|
|
|
## Inputs
|
|
|
|
|
|
|
|
|
|
| Input Name | Description | Required | Type | Default Value |
|
|
|
|
|
|-------------|-------------------------------------|----------|--------|-------------------------|
|
|
|
|
|
| `source` | The path to the Go source file to build. | No | string | `./main.go` |
|
|
|
|
|
| `target` | The output path for build artifacts. | No | string | `./dist/main` |
|
|
|
|
|
| `go-version`| The Go version to use. | No | string | `>=1.23` |
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
This action can be called from other workflows using `workflow_call`. Below is an example of how to invoke it:
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
jobs:
|
|
|
|
|
build:
|
2024-11-28 14:10:23 +01:00
|
|
|
uses: DevFW-CICD/build/.github/workflows/build-go.yml@main
|
2024-11-28 10:17:43 +01:00
|
|
|
with:
|
|
|
|
|
source: './cmd/app/main.go'
|
|
|
|
|
target: './build/app'
|
|
|
|
|
go-version: '1.19'
|
|
|
|
|
```
|