From 62548955dc3a65b5f1140651c289f2d3634d09fc Mon Sep 17 00:00:00 2001 From: Unlock Music Dev Date: Sun, 20 Nov 2022 12:41:25 +0800 Subject: [PATCH] chore: add release script --- .gitignore | 2 ++ misc/release.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 misc/release.sh diff --git a/.gitignore b/.gitignore index 485dee6..d5502c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .idea + +/dist diff --git a/misc/release.sh b/misc/release.sh new file mode 100755 index 0000000..3f73fbc --- /dev/null +++ b/misc/release.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +PLATFORMS=( + "linux/amd64" + "linux/arm64" + "darwin/amd64" + "darwin/arm64" + "windows/amd64" + "windows/386" +) + +DEST_DIR=${DEST_DIR:-"dist"} + +for PLATFORM in "${PLATFORMS[@]}"; do + GOOS=${PLATFORM%/*} + GOARCH=${PLATFORM#*/} + echo "Building for $GOOS/$GOARCH" + + FILENAME="um-$GOOS-$GOARCH" + if [ "$GOOS" = "windows" ]; then + FILENAME="$FILENAME.exe" + fi + + GOOS=$GOOS GOARCH=$GOARCH go build -v \ + -o "${DEST_DIR}/${FILENAME}" \ + -ldflags "-s -w -X main.AppVersion=$(git describe --tags --always --dirty)" \ + ./cmd/um +done + +cd "$DEST_DIR" +sha256sum um-* > sha256sums.txt \ No newline at end of file