chore: separate darwin build configuration into .goreleaser-darwin.yaml and update action

This commit is contained in:
Karol Broda
2025-12-17 00:11:13 +01:00
parent eee7cfd64d
commit 7f2bd068ad
3 changed files with 43 additions and 67 deletions

View File

@@ -9,7 +9,7 @@ permissions:
contents: write contents: write
jobs: jobs:
build-linux: release-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -20,21 +20,16 @@ jobs:
with: with:
go-version: "1.25.0" go-version: "1.25.0"
- name: build linux binaries - name: release linux
uses: goreleaser/goreleaser-action@v6 uses: goreleaser/goreleaser-action@v6
with: with:
version: "~> v2" version: "~> v2"
args: build --clean --id linux args: release --clean
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: upload linux artifacts release-darwin:
uses: actions/upload-artifact@v4 needs: release-linux
with:
name: linux-dist
path: dist/
build-darwin:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -45,49 +40,10 @@ jobs:
with: with:
go-version: "1.25.0" go-version: "1.25.0"
- name: build darwin binaries - name: release darwin
uses: goreleaser/goreleaser-action@v6 uses: goreleaser/goreleaser-action@v6
with: with:
version: "~> v2" version: "~> v2"
args: build --clean --id darwin args: release --clean --config .goreleaser-darwin.yaml --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: upload darwin artifacts
uses: actions/upload-artifact@v4
with:
name: darwin-dist
path: dist/
release:
needs: [build-linux, build-darwin]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: "1.25.0"
- name: download linux artifacts
uses: actions/download-artifact@v4
with:
name: linux-dist
path: dist/
- name: download darwin artifacts
uses: actions/download-artifact@v4
with:
name: darwin-dist
path: dist/
merge-multiple: true
- name: release
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: release --clean --skip=build
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

36
.goreleaser-darwin.yaml Normal file
View File

@@ -0,0 +1,36 @@
version: 2
project_name: snitch
builds:
- id: darwin
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X snitch/cmd.Version={{.Version}}
- -X snitch/cmd.Commit={{.ShortCommit}}
- -X snitch/cmd.Date={{.Date}}
archives:
- formats:
- tar.gz
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- .Os }}_
{{- .Arch }}
release:
github:
owner: karol-broda
name: snitch
draft: false
prerelease: auto
mode: append

View File

@@ -24,20 +24,6 @@ builds:
- -X snitch/cmd.Commit={{.ShortCommit}} - -X snitch/cmd.Commit={{.ShortCommit}}
- -X snitch/cmd.Date={{.Date}} - -X snitch/cmd.Date={{.Date}}
- id: darwin
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X snitch/cmd.Version={{.Version}}
- -X snitch/cmd.Commit={{.ShortCommit}}
- -X snitch/cmd.Date={{.Date}}
archives: archives:
- formats: - formats:
- tar.gz - tar.gz
@@ -74,8 +60,6 @@ nfpms:
- deb - deb
- rpm - rpm
- apk - apk
ids:
- linux
release: release:
github: github: