From 7f2bd068ad5b5e33dba35bb87c6664b902d7e904 Mon Sep 17 00:00:00 2001 From: Karol Broda Date: Wed, 17 Dec 2025 00:11:13 +0100 Subject: [PATCH] chore: separate darwin build configuration into .goreleaser-darwin.yaml and update action --- .github/workflows/release.yaml | 58 ++++------------------------------ .goreleaser-darwin.yaml | 36 +++++++++++++++++++++ .goreleaser.yaml | 16 ---------- 3 files changed, 43 insertions(+), 67 deletions(-) create mode 100644 .goreleaser-darwin.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 63f9a46..ca9e23e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 }} diff --git a/.goreleaser-darwin.yaml b/.goreleaser-darwin.yaml new file mode 100644 index 0000000..3915945 --- /dev/null +++ b/.goreleaser-darwin.yaml @@ -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 + diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 3d0315d..22b6eb7 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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: