Split the releases into a MacOS one and Linux/Windows one

This is to add support for building the MacOS binary using CGO.
This commit is contained in:
Leon Mika 2022-11-18 22:14:33 +11:00 committed by GitHub
parent 0c541da1c6
commit 55b8103416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 26 deletions

View file

@ -11,7 +11,6 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
localstack: localstack:
image: localstack/localstack image: localstack/localstack

View file

@ -4,10 +4,9 @@ on:
push: push:
tags: tags:
- 'v*' - 'v*'
jobs: jobs:
release: build:
runs-on: macos-12 runs-on: ubuntu-latest
services: services:
localstack: localstack:
image: localstack/localstack image: localstack/localstack
@ -32,12 +31,51 @@ jobs:
go test -p 1 ./... go test -p 1 ./...
env: env:
GOPRIVATE: "github:com/lmika/*" GOPRIVATE: "github:com/lmika/*"
release-macos:
needs: build
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Configure
run: |
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika"
- name: Setup Goreleaser
run: |
brew install goreleaser/tap/goreleaser
brew install goreleaser
- name: Release
if: startsWith(github.ref, 'refs/tags/')
run: |
goreleaser release -f macos.goreleaser.yml --snapshot --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
release-linux:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Configure
run: |
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika"
- name: Release - name: Release
uses: goreleaser/goreleaser-action@v1 uses: goreleaser/goreleaser-action@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
version: latest version: latest
args: release --skip-validate --rm-dist args: release --skip-validate --rm-dist --skip-publish
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }} HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}

View file

@ -3,8 +3,6 @@ builds:
targets: targets:
- windows_amd64 - windows_amd64
- linux_amd64 - linux_amd64
- darwin_amd64
- darwin_arm64
env: env:
- CGO_ENABLED=1 - CGO_ENABLED=1
main: ./cmd/dynamo-browse/. main: ./cmd/dynamo-browse/.
@ -19,8 +17,6 @@ archives:
format: zip format: zip
- goos: linux - goos: linux
format: tar.gz format: tar.gz
- goos: macos
format: tar.gz
nfpms: nfpms:
- id: package_nfpms - id: package_nfpms
package_name: audax package_name: audax
@ -35,23 +31,7 @@ nfpms:
- deb - deb
- rpm - rpm
bindir: /usr/local/bin bindir: /usr/local/bin
brews:
- name: audax
tap:
owner: lmika
name: homebrew-audax
token: "{{ .Env.HOMEBREW_GITHUB_TOKEN }}"
folder: Formula
homepage: https://audax.tools
description: TUI tools for AWS administration
license: MIT
checksum: checksum:
name_template: 'checksums.txt' name_template: 'checksums.txt'
snapshot: snapshot:
name_template: "{{ .Tag }}-next" name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

31
macos.goreleaser.yml Normal file
View file

@ -0,0 +1,31 @@
builds:
- id: dynamo-browse
targets:
- darwin_amd64
- darwin_arm64
env:
- CGO_ENABLED=1
main: ./cmd/dynamo-browse/.
binary: dynamo-browse
archives:
- id: zip
builds:
- dynamo-browse
wrap_in_directory: true
format_overrides:
- goos: macos
format: tar.gz
brews:
- name: audax
tap:
owner: lmika
name: homebrew-audax
token: "{{ .Env.HOMEBREW_GITHUB_TOKEN }}"
folder: Formula
homepage: https://audax.tools
description: TUI tools for AWS administration
license: MIT
checksum:
name_template: 'checksums-macos.txt'
snapshot:
name_template: "{{ .Tag }}-next"