Skip to content

Support different build branches (#30) #115

Support different build branches (#30)

Support different build branches (#30) #115

Workflow file for this run

name: Docker build
on:
push:
release:
types:
- published
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: false
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
args: -p bugs -p unused --timeout=3m
- name: Test
run: make test test-generate
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: false
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
args: --build-tags client -p bugs -p unused --timeout=3m
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
push: true
sbom: true
tags: >
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ (env.BRANCH_NAME == 'main' && 'latest') || env.BRANCH_NAME }}