Reusable GitHub Actions workflows for CI/CD. Centralizes logic, reduces duplication, and simplifies maintenance across multiple projects.
This repository is a workflow library that other projects can use:
# In your project - just 10 lines
jobs:
build:
uses: adnvilla/gha-toolkit/.github/workflows/[email protected]
with:
go-version: '1.24'Instead of having ~200 lines of duplicated workflows in each project.
Benefits:
- ✅ 95% less duplicated code
- ✅ Centralized updates
- ✅ Controlled versioning (each project uses the version it needs)
- ✅ Simplified maintenance
- EXAMPLES.md - Practical usage examples
- CONTRIBUTING.md - How to add workflows
- ARCHITECTURE.md - Technical details
This toolkit uses automatic semantic versioning:
# Specific version (RECOMMENDED for production)
uses: adnvilla/gha-toolkit/.github/workflows/[email protected]
# Latest 1.x version (auto-updates)
uses: adnvilla/gha-toolkit/.github/workflows/go.yml@v1
# Latest version (development)
uses: adnvilla/gha-toolkit/.github/workflows/go.yml@masterEach commit with feat: or fix: automatically generates a new version.
Build and test for Go projects with integrated PostgreSQL.
Usage:
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
test:
uses: adnvilla/gha-toolkit/.github/workflows/[email protected]
with:
go-version: '1.24' # Optional, default: '1.24'
postgres-version: '15' # Optional, default: '15'
run-tests: true # Optional, default: true
postgres-dsn: 'host=localhost user=postgres password=postgres dbname=postgres port=5432 sslmode=disable' # OptionalGenerates automatic releases with semantic versioning.
Usage:
name: Release
on:
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [master]
jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: adnvilla/gha-toolkit/.github/workflows/[email protected]
permissions:
contents: write
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}Required configuration: Copy .releaserc.json.example to your project as .releaserc.json
- v1.1.0: Node.js/TypeScript (npm, yarn, pnpm)
- v1.2.0: Python (pytest, coverage, lint)
- v1.3.0: Docker (multi-platform builds)
- v1.4.0: Terraform (plan, apply, security scan)
Have an idea? Open an issue or contribute following CONTRIBUTING.md
To use the release workflow, create .releaserc.json in your project:
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/git",
"@semantic-release/github"
]
}See .releaserc.json.example for complete configuration.
Automatic versioning works with commits in this format:
feat: new feature→ minor version (1.0.0 → 1.1.0)fix: bug fix→ patch version (1.0.0 → 1.0.1)feat!: breaking change→ major version (1.0.0 → 2.0.0)docs:,chore:, etc. → no release
cd d:\Code\gha-toolkit
git add .
git commit -m "feat: initial release of reusable workflows toolkit
BREAKING CHANGE: Initial release"
git push origin masterThis will automatically create version v1.0.0.
Wait for v1.0.0 to be available, then in your Go projects:
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
build:
uses: adnvilla/gha-toolkit/.github/workflows/[email protected]
with:
go-version: '1.24'See EXAMPLES.md for more examples.
MIT