From 3b5c7a7618618df08680a53b713e627e37adcf9d Mon Sep 17 00:00:00 2001 From: jshlbrd Date: Sat, 14 Dec 2024 08:25:18 -0800 Subject: [PATCH] ci: Add GoReleaser Support for macOS --- .github/workflows/release_please.yml | 24 +++++++++++++++- .goreleaser.yaml | 42 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release_please.yml b/.github/workflows/release_please.yml index 297e9acd..123c1236 100644 --- a/.github/workflows/release_please.yml +++ b/.github/workflows/release_please.yml @@ -16,7 +16,29 @@ jobs: runs-on: ubuntu-latest steps: - - uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3 + - name: Tag Release + id: release + uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3 with: release-type: go package-name: release-please-action + + - name: Checkout Repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version: 1.22 + + - name: Upload Release Artifact + if: ${{ steps.release.outputs.releases_created }} + uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ steps.release.outputs.tag_name }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..feaa2fb8 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,42 @@ +version: 2 + +before: + hooks: + - go mod tidy + +builds: + - env: + - CGO_ENABLED=0 + goos: + - darwin + goarch: + - amd64 + - arm64 + + main: ./cmd/substation + binary: substation + +release: + mode: keep-existing # required for compatibility with release-please + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:"