chore: add release script

This commit is contained in:
Unlock Music Dev 2022-11-20 12:41:25 +08:00
parent 3794ff3154
commit 62548955dc
Signed by: um-dev
GPG Key ID: 95202E10D3413A1D
2 changed files with 34 additions and 0 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
.idea
/dist

32
misc/release.sh Executable file
View File

@ -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