Files
shared-actions/.github/workflows/go-release.yaml
T
lukaszraczylo e4dac8969a chore(actions): bump shared actions to latest major versions
- actions/checkout v4 -> v6
- actions/setup-go v5 -> v6
- actions/setup-node v4 -> v6
- actions/upload-artifact v4 -> v7
- actions/download-artifact v4 -> v8
- actions/github-script v7 -> v9
- goreleaser/goreleaser-action v6 -> v7
- docker/login-action v3 -> v4
- docker/setup-buildx-action v3 -> v4
- docker/setup-qemu-action v3 -> v4
- sigstore/cosign-installer v3 -> v4
- peter-evans/create-pull-request v7 -> v8
2026-05-21 03:14:01 +01:00

156 lines
4.2 KiB
YAML

name: Go Release
on:
workflow_call:
inputs:
go-version:
description: "Go version to use"
required: false
type: string
default: ">=1.24"
semver-config:
description: "Path to semver config file"
required: false
type: string
default: "semver.yaml"
docker-enabled:
description: "Enable Docker builds"
required: false
type: boolean
default: false
docker-registry:
description: "Docker registry to push to"
required: false
type: string
default: "ghcr.io"
rolling-release-tag:
description: "Create a rolling release tag (e.g., 'v1')"
required: false
type: string
default: ""
lfs:
description: "Enable Git LFS checkout (for repos with large files)"
required: false
type: boolean
default: false
outputs:
version:
description: "The calculated version (without v prefix)"
value: ${{ jobs.version.outputs.version }}
version_tag:
description: "The version tag (with v prefix)"
value: ${{ jobs.version.outputs.version_tag }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: ${{ inputs.lfs }}
- name: Run workflow prepare script
shell: bash
run: |
if [ -f "./workflow-prepare.sh" ]; then
chmod +x ./workflow-prepare.sh
./workflow-prepare.sh
fi
- name: Run tests
uses: lukaszraczylo/shared-actions/.github/actions/go-test@main
with:
go-version: ${{ inputs.go-version }}
version:
name: Calculate Version
needs: test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.semver.outputs.version }}
version_tag: ${{ steps.semver.outputs.version_tag }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
lfs: ${{ inputs.lfs }}
- name: Run workflow prepare script
shell: bash
run: |
if [ -f "./workflow-prepare.sh" ]; then
chmod +x ./workflow-prepare.sh
./workflow-prepare.sh
fi
- name: Calculate version
id: semver
uses: lukaszraczylo/shared-actions/.github/actions/semver@main
with:
config-file: ${{ inputs.semver-config }}
release:
name: Release
needs: version
if: needs.version.outputs.version_tag != ''
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
lfs: ${{ inputs.lfs }}
- name: Run workflow prepare script
shell: bash
run: |
if [ -f "./workflow-prepare.sh" ]; then
chmod +x ./workflow-prepare.sh
./workflow-prepare.sh
fi
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version }}
# Docker setup (optional)
- name: Set up QEMU
if: inputs.docker-enabled
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
if: inputs.docker-enabled
uses: docker/setup-buildx-action@v4
- name: Login to GHCR
if: inputs.docker-enabled
uses: docker/login-action@v4
with:
registry: ${{ inputs.docker-registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: lukaszraczylo/shared-actions/.github/actions/goreleaser@main
with:
version-tag: ${{ needs.version.outputs.version_tag }}
mode: full
github-token: ${{ secrets.GITHUB_TOKEN }}
homebrew-tap-token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
- name: Rolling release
if: inputs.rolling-release-tag != ''
uses: lukaszraczylo/shared-actions/.github/actions/rolling-release@main
with:
tag: ${{ inputs.rolling-release-tag }}
version-tag: ${{ needs.version.outputs.version_tag }}
github-token: ${{ secrets.GITHUB_TOKEN }}