From 4036a4594b9b5941ed5c2212cb61583d5f50ae8c Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sun, 17 Apr 2022 11:44:57 -0700 Subject: [PATCH] Add config for building/releasing binaries for other OSs --- .github/workflows/go-test.yml | 1 + .slsa-goreleaser-darwin-amd64.yml | 12 ++++++++ .slsa-goreleaser-darwin-arm.yml | 12 ++++++++ ...er.yml => .slsa-goreleaser-linux-amd64.yml | 0 Makefile | 28 ++++++++++++++++--- VERSION | 2 +- 6 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 .slsa-goreleaser-darwin-amd64.yml create mode 100644 .slsa-goreleaser-darwin-arm.yml rename .slsa-goreleaser.yml => .slsa-goreleaser-linux-amd64.yml (100%) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 2ca2a2d..af8a9a6 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -17,6 +17,7 @@ jobs: with: go-version: 1.17 - name: Go test + if: !startsWith(github.event.head_commit.message, 'Release') run: make test - name: Build docker contains run: make build-api build-static diff --git a/.slsa-goreleaser-darwin-amd64.yml b/.slsa-goreleaser-darwin-amd64.yml new file mode 100644 index 0000000..4ae604b --- /dev/null +++ b/.slsa-goreleaser-darwin-amd64.yml @@ -0,0 +1,12 @@ +version: 1 + +flags: + - -trimpath + +goos: darwin +goarch: amd64 + +binary: hishtory-{{ .OS }}-{{ .Arch }} + +ldflags: + - '{{ .Env.VERSION_LDFLAGS }}' diff --git a/.slsa-goreleaser-darwin-arm.yml b/.slsa-goreleaser-darwin-arm.yml new file mode 100644 index 0000000..5d7db99 --- /dev/null +++ b/.slsa-goreleaser-darwin-arm.yml @@ -0,0 +1,12 @@ +version: 1 + +flags: + - -trimpath + +goos: darwin +goarch: arm + +binary: hishtory-{{ .OS }}-{{ .Arch }} + +ldflags: + - '{{ .Env.VERSION_LDFLAGS }}' diff --git a/.slsa-goreleaser.yml b/.slsa-goreleaser-linux-amd64.yml similarity index 100% rename from .slsa-goreleaser.yml rename to .slsa-goreleaser-linux-amd64.yml diff --git a/Makefile b/Makefile index 3ad7b2c..cc45e00 100644 --- a/Makefile +++ b/Makefile @@ -9,12 +9,32 @@ acttest: act push -j test release: + # Bump the version expr `cat VERSION` + 1 > VERSION git add VERSION - git commit -m "Bump hishtory version to v0.`cat VERSION`" - git tag v0.`cat VERSION` - git push - git push --tags + git commit -m "Release: start releasing v0.`cat VERSION`" --no-verify + # Release linux-amd64 + cp .slsa-goreleaser-linux-amd64.yml .slsa-goreleaser.yml + git add .slsa-goreleaser.yml + git commit -m "Release linux-amd64 v0.`cat VERSION`" --no-verify + git tag v0.`cat VERSION`-linux-amd64 + # Release darwin-amd64 + cp .slsa-goreleaser-darwin-amd64.yml .slsa-goreleaser.yml + git add .slsa-goreleaser.yml + git commit -m "Release darwin-amd64 v0.`cat VERSION`" --no-verify + git tag v0.`cat VERSION`-darwin-amd64 + # Release darwin-arm64 + cp .slsa-goreleaser-darwin-arm64.yml .slsa-goreleaser.yml + git add .slsa-goreleaser.yml + git commit -m "Release darwin-arm64 v0.`cat VERSION`" --no-verify + git tag v0.`cat VERSION`-darwin-arm64 + # Clean up by removing .slsa-goreleaser.yml + rm .slsa-goreleaser.yml + git add .slsa-goreleaser.yml + git commit -m "Release: finish releasing v0.`cat VERSION`" --no-verify + # Push to trigger the releases + #git push + #git push --tags build-static: docker build -t gcr.io/dworken-k8s/hishtory-static -f backend/web/caddy/Dockerfile . diff --git a/VERSION b/VERSION index 64bb6b7..e85087a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -30 +31