Skip to content

emilgruzalski/gh-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Actions

A collection of reusable GitHub Actions workflows and composite actions for standardized CI/CD across multiple languages. Provides code quality checks, Docker image builds, and cross-compiled binary builds out of the box.

Getting Started

Reference any workflow from your repository using the uses keyword and point to the desired tag:

jobs:
  ci:
    uses: emilgruzalski/gh-actions/.github/workflows/ci-img-go.yml@v1
    with:
      image-name: 'my-app'
    permissions:
      contents: read
      packages: write

Copy a workflow template to your .github/workflows/ directory as a starting point and replace the placeholder values.

Available Workflows

Image CI

Build and push multi-architecture Docker images to ghcr.io. Each workflow runs code quality checks (cq) first, then builds and pushes the image (build).

Workflow Language Key Input
ci-img-go.yml Go go-version-file (default: go.mod)
ci-img-rust.yml Rust toolchain (default: stable)
ci-img-java.yml Java java-version (default: 21)
ci-img-py.yml Python python-version-file (default: pyproject.toml)
ci-img-node.yml Node.js node-version-file (default: package.json)
ci-img-dotnet.yml .NET global-json-file (default: global.json)

Shared inputs:

Input Required Default Description
image-name yes Docker image name
dockerfile no ./Dockerfile Path to Dockerfile
context no . Docker build context
push no true Whether to push the image
working-directory no . Source root directory

Outputs: image (full reference with SHA tag), digest

Example — Go:

jobs:
  ci:
    uses: emilgruzalski/gh-actions/.github/workflows/ci-img-go.yml@v1
    with:
      image-name: 'my-go-app'
      push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
    permissions:
      contents: read
      packages: write

Binary CI

Build cross-compiled binaries and upload them as GitHub Actions artifacts. Each workflow runs code quality checks (cq) first, then builds per-target in a matrix (build).

Workflow Language Cross-compilation
ci-bin-go.yml Go Native GOOS/GOARCH (CGO_ENABLED=0)
ci-bin-rust.yml Rust cross via taiki-e/install-action

Shared inputs:

Input Required Default Description
binary-name yes Output binary name
targets no see below JSON array of build targets
build-flags no "" Additional build flags
working-directory no . Source root directory

Default targets:

Workflow Default targets
ci-bin-go.yml ["linux/amd64", "linux/arm64"]
ci-bin-rust.yml ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]

Artifacts are uploaded per target, named <binary-name>-<target>[.exe].

Example — Go with custom targets:

jobs:
  ci:
    uses: emilgruzalski/gh-actions/.github/workflows/ci-bin-go.yml@v1
    with:
      binary-name: 'my-go-app'
      targets: '["linux/amd64","linux/arm64","darwin/amd64","darwin/arm64","windows/amd64"]'
    permissions:
      contents: read

Example — Rust:

jobs:
  ci:
    uses: emilgruzalski/gh-actions/.github/workflows/ci-bin-rust.yml@v1
    with:
      binary-name: 'my-rust-app'
      targets: '["x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"]'
    permissions:
      contents: read

Available Actions

Composite actions used internally by the reusable workflows. Can also be used independently.

Code Quality

Action Language Checks
cq-go Go go vet, golangci-lint, go test -race with coverage
cq-rust Rust cargo fmt --check, cargo clippy -D warnings, cargo test
cq-java Java mvn compile, mvn test
cq-py Python ruff check, ruff format --check, pytest
cq-node Node.js bun install, bun run lint, bun test, bun run build
cq-dotnet .NET dotnet restore, dotnet build, dotnet format --verify-no-changes, dotnet test

build-image

Builds a multi-architecture Docker image and pushes it to ghcr.io.

Input Required Default Description
image-name yes Docker image name
github-token yes Token for registry authentication
dockerfile no ./Dockerfile Path to Dockerfile
context no . Docker build context
platforms no linux/amd64,linux/arm64 Target platforms
push no true Whether to push the image
build-args no "" Docker build arguments

Outputs: image (full reference with SHA tag), digest

Workflow Templates

Copy a template from .github/workflow-templates/ to your repository's .github/workflows/ directory and replace the placeholder values.

Template Description
ci-img-go.yml Go Docker image CI
ci-img-rust.yml Rust Docker image CI
ci-img-java.yml Java Docker image CI
ci-img-python.yml Python Docker image CI
ci-img-node.yml Node.js Docker image CI
ci-img-dotnet.yml .NET Docker image CI
ci-bin-go.yml Go binary CI
ci-bin-rust.yml Rust binary CI

License

Apache 2.0

About

A collection of reusable GitHub Actions workflows and composite actions

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors