Created
January 4, 2015 14:13
-
-
Save hironobu-s/901bb06c2a2d706d2dd7 to your computer and use it in GitHub Desktop.
conoha-ojsをリリースビルドするスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ROOT=$GOPATH/src/github.com/hironobu-s/conoha-ojs | |
OS=("linux" "darwin" "windows") | |
ARCH=("386" "amd64" "386") | |
cd $ROOT | |
rm -fr $ROOT/release/build/* | |
for i in `seq 0 1 2` | |
do | |
# ルートに移動 | |
cd $ROOT | |
# 出力ファイル名の設定 | |
# windowsはexeファイルを出力 | |
if [ ${OS["$i"]} = "linux" ]; then | |
DESTFILE=conoha-ojs | |
else | |
DESTFILE=conoha-ojs.exe | |
fi | |
# 出力先ディレクトリ | |
DESTDIR=$ROOT/release/build/${OS["$i"]}.${ARCH["$i"]} | |
# 出力先ディレクトリを作成 | |
mkdir -p $DESTDIR | |
# ビルド | |
GOOS=${OS["$i"]} GOARCH=${ARCH["$i"]} go build -o $DESTDIR/$DESTFILE | |
# 出力先ディレクトリに移動 | |
cd $DESTDIR | |
# アーカイブ | |
if [ ${OS["$i"]} = "windows" ]; then | |
zip conoha-ojs.zip $DESTFILE | |
elif [ ${OS["$i"]} = "darwin" ]; then | |
gzip -c $DESTFILE > conoha-ojs.${OS["$i"]}.${ARCH["$i"]}.gz | |
else | |
gzip -c $DESTFILE > conoha-ojs.${OS["$i"]}.${ARCH["$i"]}.gz | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment