Compare commits

..

No commits in common. "main" and "v1.0.0" have entirely different histories.
main ... v1.0.0

2 changed files with 17 additions and 36 deletions

View File

@ -1,44 +1,31 @@
# ⚙️ Go CI/CD Composite Action
# Go CI/CD Composite Action
A reusable GitHub Action for Go projects, forged to handle various CI/CD scenarios like a true warrior of code. Supports protected branches, tagged releases, and minimal development flows — with optional Docker image publishing for applications.
> “We dont just build software — we forge legacy.”
---
## 🔧 Features
- Multiple workflow modes: `protected`, `tag`, and `minimal`
- Go version configuration
- Automatic test execution with coverage reporting
- Automatic test execution with code coverage
- Build support for both libraries and applications
- Conditional Docker image creation and publishing
- Full registry authentication support
- Easy integration across all Go-based grimoires
---
- Composable and easy to integrate in any Go project
## 📥 Inputs
| Input Name | Description | Required | Default |
|----------------------|-----------------------------------------------------------|----------|---------------|
|---------------------|-------------------------------------------------------------------------|----------|---------------|
| `workflow-type` | Type of CI/CD flow (`protected`, `minimal`, `tag`) | Yes | `protected` |
| `go-version` | Go version to install and use | No | `1.24` |
| `build-type` | Type of build (`application`, `library`) | No | `application` |
| `container-registry`| Container registry URL (used if publishing Docker image) | Yes | — |
| `registry-username` | Your container registry username | Yes | — |
| `registry-token` | Access token or password for container registry | Yes | — |
| `publish-docker` | Whether to build and push Docker image (`true` / `false`) | No | `true` |
---
## ⚙️ Workflow Types
- **protected** Full battle mode. Ideal for `main`/`release` branches. Tests, builds, and publishes.
- **minimal** Light mode for PRs and early dev. Just tests and builds.
- **tag** Triggered on Git tags. Behaves like `protected`, meant for releases.
---
- **protected**: Full CI/CD pipeline for mainline branches. Runs tests, builds the binary, and optionally publishes a Docker image.
- **minimal**: Lean setup for pull requests or early development. Runs tests and builds only.
- **tag**: Triggered on Git tags. Behaves like `protected`, ideal for versioned releases.
## 🚀 How to Use

View File

@ -17,12 +17,6 @@ inputs:
container-registry:
description: 'Container registry url'
required: true
registry-username:
description: 'The registry username'
required: true
registry-token:
description: 'The registry authentication token'
required: true
publish-docker:
description: 'Publish Docker image (true/false)'
required: false
@ -49,8 +43,8 @@ runs:
- name: Run tests
shell: bash
run: |
go test -json > test-report.out ./...
go test -coverprofile=coverage.out ./...
go test -json > test-report.out
go test -coverprofile=coverage.out
- name: Build library
if: inputs.build-type == 'library'
@ -93,8 +87,8 @@ runs:
uses: docker/login-action@v3
with:
registry: ${{ inputs.container-registry }}
username: ${{ inputs.registry-username }}
password: ${{ inputs.registry-token }}
username: ${{ env.DEPLOYER_USERNAME }}
password: ${{ secrets.DEPLOYER_TOKEN }}
- name: Set up Docker Buildx
if: inputs.publish-docker == 'true' && inputs.build-type == 'application' && (inputs.workflow-type == 'protected' || inputs.workflow-type == 'tag')