mirror of
https://github.com/lukaszraczylo/shared-actions.git
synced 2026-07-06 06:24:46 +00:00
feat: use goreleaser for build/archive, gh CLI for release
Since GoReleaser Pro is needed for split/merge, use this approach: - Split mode: goreleaser release --skip=publish --single-target (builds + archives) - Merge mode: gh CLI to create release and upload artifacts This allows CGO matrix builds without requiring Pro license. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,23 +46,47 @@ runs:
|
|||||||
HOMEBREW_TAP_TOKEN: ${{ inputs.homebrew-tap-token }}
|
HOMEBREW_TAP_TOKEN: ${{ inputs.homebrew-tap-token }}
|
||||||
CGO_ENABLED: ${{ inputs.cgo-enabled }}
|
CGO_ENABLED: ${{ inputs.cgo-enabled }}
|
||||||
|
|
||||||
- name: Run GoReleaser (build only for CGO matrix)
|
- name: Run GoReleaser (build + archive for CGO matrix)
|
||||||
if: inputs.mode == 'split'
|
if: inputs.mode == 'split'
|
||||||
uses: goreleaser/goreleaser-action@v6
|
uses: goreleaser/goreleaser-action@v6
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: "~> v2"
|
version: "~> v2"
|
||||||
args: build --clean --single-target
|
args: release --clean --skip=publish --single-target
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ inputs.github-token }}
|
GITHUB_TOKEN: ${{ inputs.github-token }}
|
||||||
CGO_ENABLED: ${{ inputs.cgo-enabled }}
|
CGO_ENABLED: ${{ inputs.cgo-enabled }}
|
||||||
|
GORELEASER_CURRENT_TAG: ${{ inputs.version-tag }}
|
||||||
|
|
||||||
- name: Run GoReleaser (release with pre-built artifacts)
|
- name: Create GitHub Release and upload artifacts
|
||||||
if: inputs.mode == 'merge'
|
if: inputs.mode == 'merge'
|
||||||
uses: goreleaser/goreleaser-action@v6
|
shell: bash
|
||||||
with:
|
|
||||||
distribution: goreleaser
|
|
||||||
version: "~> v2"
|
|
||||||
args: release --skip=build
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ inputs.github-token }}
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user