name: Create Release
on:
workflow_dispatch:
inputs:
bump_type:
description: 'Version bump type'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch
permissions:
contents: write
packages: write
env:
GO_VERSION: "1.24.11"
REGISTRY: ghcr.io
jobs:
create-release:
name: Create Tag and Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Bump version and create tag
id: tag
uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: ${{ github.event.inputs.bump_type }}
TAG_PREFIX: v
VERBOSE: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
if: steps.tag.outputs.new_tag != ''
with:
version: latest
distribution: goreleaser
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
if: steps.tag.outputs.new_tag != ''
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=semver,pattern={{version}},value=${{ steps.tag.outputs.new_tag }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.new_tag }}
type=semver,pattern={{major}},value=${{ steps.tag.outputs.new_tag }}
latest
- name: Set up Docker Buildx
if: steps.tag.outputs.new_tag != ''
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: steps.tag.outputs.new_tag != ''
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: steps.tag.outputs.new_tag != ''
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64,amd64,arm'
- name: downcase REPO
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Build and push Docker image
if: steps.tag.outputs.new_tag != ''
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
cache-to: |
type=gha,mode=max
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
provenance: true
sbom: true
build-args: |
BUILDKIT_INLINE_CACHE=1