name: "GoReleaser" description: "Run GoReleaser with optional split/merge for CGO builds" inputs: version-tag: description: "Version tag to release" required: true mode: description: "Mode: 'full' (single runner), 'split' (matrix build), 'merge' (combine split builds)" required: false default: "full" cgo-enabled: description: "Enable CGO" required: false default: "0" github-token: description: "GitHub token" required: true homebrew-tap-token: description: "Homebrew tap token (optional)" required: false default: "" runs: using: "composite" steps: - name: Create tag shell: bash run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git tag -a ${{ inputs.version-tag }} -m "Release ${{ inputs.version-tag }}" || true if [[ "${{ inputs.mode }}" != "split" ]]; then git push origin ${{ inputs.version-tag }} || true fi - name: Run GoReleaser (full) if: inputs.mode == 'full' uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: "~> v2" args: release --clean env: GITHUB_TOKEN: ${{ inputs.github-token }} HOMEBREW_TAP_TOKEN: ${{ inputs.homebrew-tap-token }} CGO_ENABLED: ${{ inputs.cgo-enabled }} - name: Run GoReleaser (build + archive for CGO matrix) if: inputs.mode == 'split' uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: "~> v2" args: release --clean --skip=publish --single-target env: GITHUB_TOKEN: ${{ inputs.github-token }} CGO_ENABLED: ${{ inputs.cgo-enabled }} GORELEASER_CURRENT_TAG: ${{ inputs.version-tag }} - name: Create GitHub Release and upload artifacts if: inputs.mode == 'merge' shell: bash env: GITHUB_TOKEN: ${{ inputs.github-token }} VERSION_TAG: ${{ inputs.version-tag }} run: | # List downloaded artifacts echo "=== Downloaded artifacts ===" find dist -type f | head -50 # Create release if it doesn't exist gh release view "$VERSION_TAG" >/dev/null 2>&1 || \ gh release create "$VERSION_TAG" \ --title "Release $VERSION_TAG" \ --generate-notes # Upload all archive files for archive in dist/*.tar.gz dist/*.zip; do if [[ -f "$archive" ]]; then echo "Uploading: $archive" gh release upload "$VERSION_TAG" "$archive" --clobber fi done # Upload checksums if present for checksum in dist/checksums*.txt; do if [[ -f "$checksum" ]]; then echo "Uploading: $checksum" gh release upload "$VERSION_TAG" "$checksum" --clobber fi done