From bfb4427233d47965909e8c055f96b1fe9ee944f6 Mon Sep 17 00:00:00 2001 From: Tomi Hakala Date: Sun, 17 Mar 2024 13:30:58 +0200 Subject: [PATCH] Update build and release configuration --- .github/workflows/build-and-release.yml | 11 +---- .goreleaser.yml | 57 +++++++++++++++++++++---- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index e332677..804938d 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,7 +8,7 @@ on: jobs: release: name: Release - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Check out code uses: actions/checkout@v4 @@ -19,15 +19,6 @@ jobs: go-version: 1.22 check-latest: true - - name: Clean up dist directory - run: rm -rf dist/ - - - name: Install GoReleaser - uses: goreleaser/goreleaser-action@v5 - with: - version: latest - args: release --clean --snapshot - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index e337b39..8cae289 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -3,18 +3,57 @@ before: hooks: - go mod tidy - go generate ./... + +# Define builds for Linux and Windows builds: -- env: - - CGO_ENABLED=0 - goos: - - linux - goarch: - - amd64 - - arm64 + - binary: birdnet-pi2go + env: + - CGO_ENABLED=0 + ldflags: + - -s -w + flags: + - -trimpath + goos: + - linux + - windows + goarch: + - amd64 + - arm64 + goarm: + - '7' + ignore: + - goos: windows + goarch: arm64 + +# Package the Linux builds into .deb +nfpms: + - id: default + package_name: birdnet-pi2go + + vendor: "Tomi P. Hakala" + homepage: "https://github.com/tphakala/birdnet-pi2go" + maintainer: "Tomi P. Hakala " + description: "BirdNET-Pi2Go is a data migration tool designed to facilitate the conversion of BirdNET-Pi database contents and audio files to the BirdNET-Go data model." + license: "MIT" + + formats: + - deb + + bindir: "/usr/local/bin" + +# Archive configuration for both Linux and Windows archives: -- format: tar.gz - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + - id: birdnet-pi2go + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + format: tar.gz + format_overrides: + - goos: windows + format: zip + +# Include checksums for all artifacts checksum: name_template: 'checksums.txt' + +# Configuration for snapshot releases snapshot: name_template: "{{ .Tag }}-next"