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
jobs:
build-linux:
release-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -20,21 +20,16 @@ jobs:
with:
go-version: "1.25.0"
- name: build linux binaries
- name: release linux
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: build --clean --id linux
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: upload linux artifacts
uses: actions/upload-artifact@v4
with:
name: linux-dist
path: dist/
build-darwin:
release-darwin:
needs: release-linux
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
@@ -45,49 +40,10 @@ jobs:
with:
go-version: "1.25.0"
- name: build darwin binaries
- name: release darwin
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: build --clean --id darwin
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
args: release --clean --config .goreleaser-darwin.yaml --skip=validate
env:
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.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:
- formats:
- tar.gz
@@ -74,8 +60,6 @@ nfpms:
- deb
- rpm
- apk
ids:
- linux
release:
github: