diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 63930ba..3721999 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -1,28 +1,64 @@ -name: goreleaser +version: 2 -on: - push: - tags: - - "*" +before: + hooks: + - go mod tidy + - go generate ./... -permissions: - contents: write +builds: + - id: build-linux-windows + goos: + - windows + - linux + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=0 + flags: + - -trimpath + when: + env: + BUILD_TARGET: linux-windows -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v5 - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser - version: "~> v2" - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - id: build-macos + goos: + - darwin + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=1 + flags: + - -trimpath + when: + env: + BUILD_TARGET: macos + +archives: + - format: tar.gz + 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 }} + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +checksum: + name_template: "checksums.txt" + +release: + github: + owner: leandrodaf + name: Pianalyze diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 49729f9..ccdc851 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,48 +1,52 @@ -version: 2 +name: goreleaser -before: - hooks: - - go mod tidy - - go generate ./... +on: + push: + tags: + - "*" -builds: - - env: - - CGO_ENABLED=0 - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - arm64 +permissions: + contents: write -archives: - - format: tar.gz - 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 }} - format_overrides: - - goos: windows - format: zip +jobs: + build-linux-windows: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + - name: Run GoReleaser for Linux and Windows + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BUILD_TARGET: linux-windows + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean --skip=publish,validate -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" - -checksum: - name_template: "checksums.txt" - -snapshot: - name_template: "{{ .Tag }}-{{ .ShortCommit }}" - -release: - github: - owner: leandrodaf - name: Pianalyze + build-macos: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + - name: Run GoReleaser for macOS + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BUILD_TARGET: macos + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean --skip=publish,validate