diff --git a/.releaserc.json b/.releaserc.json index f25fa394..23e007c3 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -23,6 +23,14 @@ { "path": "console_windows_x64.exe", "label": "Windows x64 Console Executable" + }, + { + "path": "console_mac_x64.exe", + "label": "Mac x64 Console Executable" + }, + { + "path": "console_mac_arm64.exe", + "label": "Mac arm64 Console Executable" } ] } @@ -31,7 +39,7 @@ [ "@semantic-release/exec", { - "prepareCmd": "docker build -t vprodemo.azurecr.io/console:v${nextRelease.version} . && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags \"-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'\" -trimpath -o console_linux_x64 ./cmd/app/main.go && CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags \"-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'\" -trimpath -o console_windows_x64.exe ./cmd/app/main.go", + "prepareCmd": "./build.sh", "publishCmd": "docker push vprodemo.azurecr.io/console:v${nextRelease.version}", "verifyReleaseCmd": "echo v${nextRelease.version} > .nextVersion" } diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..7ceee1a4 --- /dev/null +++ b/build.sh @@ -0,0 +1,24 @@ +# Build Docker image +docker build -t vprodemo.azurecr.io/console:v${nextRelease.version} . + +# Build for Linux +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'" -trimpath -o console_linux_x64 ./cmd/app/main.go + +# Build for Windows +CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'" -trimpath -o console_windows_x64.exe ./cmd/app/main.go + +# Build for Mac (x64) +CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'" -trimpath -o console_mac_x64 ./cmd/app/main.go + +# Build for Mac (arm64) +CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'" -trimpath -o console_mac_arm64 ./cmd/app/main.go + +# Mark the Unix system outputs as executable +chmod +x console_linux_x64 +chmod +x console_mac_x64 +chmod +x console_mac_arm64 + +# Add them to tar files respectively +tar cvf console_linux_x64.tar console_linux_x64 +tar cvf console_mac_x64.tar console_mac_x64 +tar cvf console_mac_arm64.tar console_mac_arm64 \ No newline at end of file