Skip to content

Update release.yml

Update release.yml #31

Workflow file for this run

name: Create release
permissions:
contents: write
on:
workflow_dispatch:
inputs:
version:
description: "The release version"
required: true
type: string
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Go version
id: version
run: awk '{if($1 == "go") print "version=" $2}' go.mod >> "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{steps.version.outputs.version}}
- name: Tag version
if: github.event_name == 'workflow_dispatch'
run: |
git fetch --force --tags
git tag --force ${{ github.event.inputs.version }}
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.PAT }}