This commit is contained in:
commit
75edd598b0
5 changed files with 99 additions and 0 deletions
30
.github/workflows/build-docker.yml
vendored
Normal file
30
.github/workflows/build-docker.yml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
name: Build Docker Container
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
source:
|
||||
description: 'The source directory to build'
|
||||
required: false
|
||||
type: string
|
||||
default: './'
|
||||
tag:
|
||||
description: 'The tag to apply to the built image'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-go:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker:27.4.0-rc.2-dind-alpine3.20
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
run: git clone https://wf:${{ github.token }}@{{ github.server_url }}/{{ github.repository_owner }}/{{ github.repository }}.git
|
||||
- name: Check Out Branch
|
||||
run: |
|
||||
cd <repo>
|
||||
git checkout <branch-name>
|
||||
- name: Build Docker Container
|
||||
run: |
|
||||
docker build -t ${{ inputs.tag }} ${{ inputs.source }}
|
8
.github/workflows/build-go-test.yml
vendored
Normal file
8
.github/workflows/build-go-test.yml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
on: [push]
|
||||
jobs:
|
||||
test_build:
|
||||
uses: ./.github/workflows/build-go.yml
|
||||
with:
|
||||
go-version: '1.23'
|
||||
source: './main.go'
|
||||
target: './dist/main'
|
37
.github/workflows/build-go.yml
vendored
Normal file
37
.github/workflows/build-go.yml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
name: Build Docker Container
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
source:
|
||||
description: 'The source file to build'
|
||||
required: false
|
||||
type: string
|
||||
default: './main.go'
|
||||
target:
|
||||
description: 'The output to store the build artifacts'
|
||||
required: false
|
||||
type: string
|
||||
default: ./dist/main'
|
||||
go-version:
|
||||
description: 'The version of Go to use'
|
||||
required: false
|
||||
type: string
|
||||
default: '>=1.23'
|
||||
|
||||
jobs:
|
||||
build-go:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/node:20-bookworm
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
- name: Set up Go
|
||||
run: |
|
||||
go version
|
||||
- name: Run go test
|
||||
run: |
|
||||
go build -o ${{ inputs.target }} ${{ inputs.source }}
|
17
README.md
Normal file
17
README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Pipeline Component - Build
|
||||
|
||||
This component is responsible for building software artifacts.
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Default | Required |
|
||||
|------|-------------|---------|:--------:|
|
||||
| source | The source directory to build | `./` | false |
|
||||
| target | The target directory to store the build artifacts | `./dist` | false |
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
|
||||
|
||||
```
|
7
main.go
Normal file
7
main.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, World!")
|
||||
}
|
Loading…
Reference in a new issue