Skip to content

release

release #6

Workflow file for this run

---
name: release
on:
release:
types: [published]
workflow_dispatch:
inputs:
dry_run:
description: 'Run in dry-run mode (snapshot, no publish)'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'
permissions:
contents: write
packages: write
id-token: write
attestations: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6.0.0
with:
go-version: stable
- name: Extract Version from Tag
id: version
if: github.event_name == 'release'
run: |
# Extract version from monorepo tags like protoc-gen-elixir-grpc@v0.1.0
TAG="${{ github.event.release.tag_name }}"
VERSION="${TAG##*@}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Extracted version: ${VERSION} from tag: ${TAG}"
- name: Run GoReleaser (Snapshot)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true'
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --snapshot --clean --skip=publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser (Release)
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false')
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.version || github.ref_name }}
- name: Attest Build Provenance
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false')
uses: actions/attest-build-provenance@v2
with:
subject-path: "dist/**/*"
- name: Upload Snapshot Artifacts
if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true'
uses: actions/upload-artifact@v4
with:
name: snapshot-binaries
path: dist/*
retention-days: 7