Skip to content

goreleaser

goreleaser #54

Workflow file for this run

name: goreleaser
on:
push:
# run only against tags
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: Existing fork tag to release, for example v6.9.36-0
required: false
type: string
permissions:
contents: write
concurrency:
group: goreleaser-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag || github.ref }}
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '>=1.26.0'
cache: true
- name: Generate Build Metadata
run: |
VERSION="${{ inputs.tag }}"
if [ -z "$VERSION" ]; then
VERSION="${GITHUB_REF_NAME}"
fi
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "COMMIT=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
- name: Check existing release
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${VERSION}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "[i] ${VERSION} release already exists; skipping GoReleaser."
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- uses: goreleaser/goreleaser-action@v4
if: steps.release.outputs.exists != 'true'
with:
distribution: goreleaser
version: latest
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
COMMIT: ${{ env.COMMIT }}
BUILD_DATE: ${{ env.BUILD_DATE }}