From 5c253ef293d8d3a9e97df09de26c218213234ae6 Mon Sep 17 00:00:00 2001 From: Kai Reichart Date: Thu, 28 Nov 2024 10:17:43 +0100 Subject: [PATCH] added readme --- .github/workflows/build-go.yml | 2 +- README.md | 17 +++-------------- build-and-push-docker.md | 31 +++++++++++++++++++++++++++++++ build-go.md | 25 +++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 build-and-push-docker.md create mode 100644 build-go.md diff --git a/.github/workflows/build-go.yml b/.github/workflows/build-go.yml index 131ec7b..c9a0869 100644 --- a/.github/workflows/build-go.yml +++ b/.github/workflows/build-go.yml @@ -1,4 +1,4 @@ -name: Build Docker Container +name: Build Go Binary on: workflow_call: diff --git a/README.md b/README.md index 35e51f8..e726671 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,6 @@ # Pipeline Component - Build -This component is responsible for building software artifacts. +This repository contains pipeline components for building software. Currently, it includes the following components: -## 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 - - -``` +- [Build Go](./build-go.md) +- [Build and Push Docker](./build-and-push-docker.md) diff --git a/build-and-push-docker.md b/build-and-push-docker.md new file mode 100644 index 0000000..d5e22d1 --- /dev/null +++ b/build-and-push-docker.md @@ -0,0 +1,31 @@ +# Build Docker Forgejo Action + +This Action builds and pushes a Docker image using Kaniko. It supports custom Dockerfiles, build contexts, and private registry authentication. + +## Inputs + +| Input Name | Description | Required | Type | Default Value | +|-------------|-----------------------------------------------|----------|--------|-----------------| +| `dockerfile`| Path to the Dockerfile to be built. | No | string | `./Dockerfile` | +| `context` | Build context directory. | No | string | `./` | +| `tag` | Tag to apply to the built image. | Yes | string | | +| `registry` | Registry to push the image to. | Yes | string | | +| `username` | Username for registry authentication. | Yes | string | | +| `password` | Password for registry authentication. | Yes | string | | + +## Usage + +This action can be invoked using `workflow_call`. Below is an example of how to use it: + +```yaml +jobs: + build: + uses: [path/to/this-action@main](https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/build/.github/workflows/build-docker.yml@main) + with: + dockerfile: './Dockerfile.custom' + context: './app' + tag: 'my-registry.com/my-app:latest' + registry: 'my-registry.com' + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} +``` diff --git a/build-go.md b/build-go.md new file mode 100644 index 0000000..0843e73 --- /dev/null +++ b/build-go.md @@ -0,0 +1,25 @@ +# 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: + uses: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/build/.github/workflows/build-go.yml@main + with: + source: './cmd/app/main.go' + target: './build/app' + go-version: '1.19' +```