Skip to content

Commit

Permalink
feat: release script
Browse files Browse the repository at this point in the history
  • Loading branch information
GNITOAHC committed Oct 5, 2024
1 parent 06d5fe9 commit 301d107
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
28 changes: 28 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

VERSION=$(git describe --tags --abbrev=0)
BINARY="md-html"
BUILD_DIR="build"

mkdir -p $BUILD_DIR

PLATFORMS=("linux/amd64" "darwin/amd64" "darwin/arm64" "windows/amd64")

for platform in "${PLATFORMS[@]}"; do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}

output_name=$BINARY
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

GOOS=$GOOS GOARCH=$GOARCH go build -o $BUILD_DIR/$output_name
tar -czf $BUILD_DIR/$BINARY-$VERSION-$GOOS-$GOARCH.tar.gz -C $BUILD_DIR $output_name

echo "Build $BINARY-$VERSION-$GOOS-$GOARCH.tar.gz done"
done

rm $BUILD_DIR/$BINARY
rm $BUILD_DIR/$BINARY.exe

0 comments on commit 301d107

Please sign in to comment.