diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 5a106d66e..38aad7c90 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -50,7 +50,12 @@ jobs: release-build: name: release-build - runs-on: ubuntu-latest + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + runs-on: ${{ matrix.os }} steps: - name: Set up Go 1.x @@ -62,10 +67,11 @@ jobs: uses: actions/checkout@v2 - name: Install dependency required for linux builds + if: matrix.os == 'ubuntu-latest' run: sudo apt-get update && sudo apt-get install -y libudev-dev - name: GoReleaser uses: goreleaser/goreleaser-action@v2 with: version: latest - args: build --snapshot --rm-dist + args: build --snapshot --rm-dist --config .goreleaser.${{ matrix.os }}.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 56c60fb99..976d489d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,15 @@ on: jobs: release: name: release - runs-on: macos-latest + strategy: + # the goreleaser and the Github release API doesn't handle concurrent + # access well, so run goreleaser serially + max-parallel: 1 + matrix: + os: + - ubuntu-latest + - macos-latest + runs-on: ${{ matrix.os }} steps: - name: Set up Go 1.x @@ -20,12 +28,13 @@ jobs: uses: actions/checkout@v2 - name: Install dependency required for linux builds + if: matrix.os == 'ubuntu-latest' run: sudo apt-get update && sudo apt-get install -y libudev-dev - name: GoReleaser uses: goreleaser/goreleaser-action@v2 with: version: latest - args: release --rm-dist + args: release --rm-dist --config .goreleaser.${{ matrix.os }}.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.macos-latest.yml b/.goreleaser.macos-latest.yml new file mode 100644 index 000000000..cbbb1d0fc --- /dev/null +++ b/.goreleaser.macos-latest.yml @@ -0,0 +1,34 @@ +--- +project_name: saml2aws + +builds: +- main: ./cmd/saml2aws/main.go + binary: saml2aws + flags: + - -trimpath + - -v + ldflags: + - -s -w -X main.Version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} + goos: + - darwin + goarch: + - amd64 + - arm64 + - arm + overrides: + - goos: linux + goarch: amd64 + goamd64: v1 + tags: + - hidraw + env: + - CGO_ENABLED=1 +archives: + - format: tar.gz + wrap_in_directory: false + # remove README and LICENSE + files: + - LICENSE.md + - README.md +checksum: + name_template: "{{ .ProjectName }}_{{ .Version }}_darwin_checksums.txt" diff --git a/.goreleaser.yml b/.goreleaser.ubuntu-latest.yml similarity index 89% rename from .goreleaser.yml rename to .goreleaser.ubuntu-latest.yml index 488869598..cd396e081 100644 --- a/.goreleaser.yml +++ b/.goreleaser.ubuntu-latest.yml @@ -11,7 +11,6 @@ builds: - -s -w -X main.Version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} goos: - windows - - darwin - linux goarch: - amd64 @@ -35,3 +34,5 @@ archives: files: - LICENSE.md - README.md +checksum: + name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt" diff --git a/Makefile b/Makefile index 3dac85ed8..5bcf4a70b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ NAME=saml2aws ARCH=$(shell uname -m) +OS=$(shell uname) VERSION=2.28.0 ITERATION := 1 @@ -36,7 +37,13 @@ install: .PHONY: mod build: $(BIN_DIR)/goreleaser - $(BIN_DIR)/goreleaser build --snapshot --rm-dist +ifeq ($(OS),Darwin) + $(BIN_DIR)/goreleaser build --snapshot --rm-dist --config $(CURDIR)/.goreleaser.macos-latest.yml +else ifeq ($(OS),Linux) + $(BIN_DIR)/goreleaser build --snapshot --rm-dist --config $(CURDIR)/.goreleaser.ubuntu-latest.yml +else + $(error Unsupported build OS: $(OS)) +endif .PHONY: build clean: