Compare commits

...

3 Commits
v1.0.0 ... main

Author SHA1 Message Date
6defc83568
Update test commands to include all packages recursively
Modified the test commands in the workflow to ensure all packages and subpackages are included during testing. This ensures comprehensive test coverage and generates accurate reports.
2025-04-25 18:22:45 -06:00
7c354b46e0
Update README.md with improved structure and detailed inputs
Enhanced README.md to include updated inputs, better descriptions, and additional sections for improved clarity. Added new fields for container registry authentication and refined workflow explanations for different CI/CD modes. Improved formatting for better readability and usability.
2025-04-22 23:58:47 -06:00
4cdb49bc38
Update action to use input-based registry credentials
Replaced hardcoded environment and secret-based credentials with input parameters for registry authentication. This change improves flexibility and allows credentials to be supplied dynamically when the action is executed.
2025-04-22 23:46:35 -06:00
2 changed files with 36 additions and 17 deletions

View File

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

View File

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