From 55b8103416aa6e239f7a90f5f002a6d2d59a5507 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Fri, 18 Nov 2022 22:14:33 +1100 Subject: [PATCH] Split the releases into a MacOS one and Linux/Windows one This is to add support for building the MacOS binary using CGO. --- .github/workflows/ci.yaml | 1 - .github/workflows/release.yaml | 46 ++++++++++++++++++++++--- .goreleaser.yml => linux.goreleaser.yml | 22 +----------- macos.goreleaser.yml | 31 +++++++++++++++++ 4 files changed, 74 insertions(+), 26 deletions(-) rename .goreleaser.yml => linux.goreleaser.yml (62%) create mode 100644 macos.goreleaser.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2a4a9db..42d0051 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,6 @@ on: jobs: build: runs-on: ubuntu-latest - services: localstack: image: localstack/localstack diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b93d954..789de15 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,10 +4,9 @@ on: push: tags: - 'v*' - jobs: - release: - runs-on: macos-12 + build: + runs-on: ubuntu-latest services: localstack: image: localstack/localstack @@ -32,12 +31,51 @@ jobs: go test -p 1 ./... env: 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 uses: goreleaser/goreleaser-action@v1 if: startsWith(github.ref, 'refs/tags/') with: version: latest - args: release --skip-validate --rm-dist + args: release --skip-validate --rm-dist --skip-publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/linux.goreleaser.yml similarity index 62% rename from .goreleaser.yml rename to linux.goreleaser.yml index 5698d53..a5495a9 100644 --- a/.goreleaser.yml +++ b/linux.goreleaser.yml @@ -3,8 +3,6 @@ builds: targets: - windows_amd64 - linux_amd64 - - darwin_amd64 - - darwin_arm64 env: - CGO_ENABLED=1 main: ./cmd/dynamo-browse/. @@ -19,8 +17,6 @@ archives: format: zip - goos: linux format: tar.gz - - goos: macos - format: tar.gz nfpms: - id: package_nfpms package_name: audax @@ -35,23 +31,7 @@ nfpms: - deb - rpm 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: name_template: 'checksums.txt' snapshot: - name_template: "{{ .Tag }}-next" -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' \ No newline at end of file + name_template: "{{ .Tag }}-next" \ No newline at end of file diff --git a/macos.goreleaser.yml b/macos.goreleaser.yml new file mode 100644 index 0000000..2609306 --- /dev/null +++ b/macos.goreleaser.yml @@ -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" \ No newline at end of file