|
|
|
@ -1,13 +1,16 @@
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
REPO=$(cd $(dirname $0); pwd)
|
|
|
|
|
REPO=$(
|
|
|
|
|
cd $(dirname $0)
|
|
|
|
|
pwd
|
|
|
|
|
)
|
|
|
|
|
COMMIT_SHA=$(git rev-parse --short HEAD)
|
|
|
|
|
VERSION=$(git describe --tags)
|
|
|
|
|
ASSETS="false"
|
|
|
|
|
BINARY="false"
|
|
|
|
|
RELEASE="false"
|
|
|
|
|
|
|
|
|
|
debugInfo () {
|
|
|
|
|
debugInfo() {
|
|
|
|
|
echo "Repo: $REPO"
|
|
|
|
|
echo "Build assets: $ASSETS"
|
|
|
|
|
echo "Build binary: $BINARY"
|
|
|
|
@ -16,28 +19,22 @@ debugInfo () {
|
|
|
|
|
echo "Commit: $COMMIT_SHA"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildAssets () {
|
|
|
|
|
buildAssets() {
|
|
|
|
|
cd $REPO
|
|
|
|
|
rm -rf assets/build
|
|
|
|
|
rm -f statik/statik.go
|
|
|
|
|
|
|
|
|
|
export CI=false
|
|
|
|
|
|
|
|
|
|
cd $REPO/assets
|
|
|
|
|
|
|
|
|
|
yarn --update-checksums
|
|
|
|
|
yarn install
|
|
|
|
|
yarn run build
|
|
|
|
|
|
|
|
|
|
if ! [ -x "$(command -v statik)" ]; then
|
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
|
go get github.com/rakyll/statik
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cd $REPO
|
|
|
|
|
statik -src=assets/build/ -include=*.html,*.js,*.json,*.css,*.png,*.svg,*.ico,*.ttf -f
|
|
|
|
|
cd build
|
|
|
|
|
rm -rf *.map
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildBinary () {
|
|
|
|
|
buildBinary() {
|
|
|
|
|
cd $REPO
|
|
|
|
|
go build -a -o cloudreve -ldflags " -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'"
|
|
|
|
|
}
|
|
|
|
@ -74,7 +71,7 @@ _build() {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
release(){
|
|
|
|
|
release() {
|
|
|
|
|
cd $REPO
|
|
|
|
|
## List of architectures and OS to test coss compilation.
|
|
|
|
|
SUPPORTED_OSARCH="linux/amd64/gcc linux/arm/arm-linux-gnueabihf-gcc windows/amd64/x86_64-w64-mingw32-gcc linux/arm64/aarch64-linux-gnu-gcc"
|
|
|
|
@ -86,8 +83,8 @@ release(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
|
echo "Usage: $0 [-a] [-c] [-b] [-r]" 1>&2;
|
|
|
|
|
exit 1;
|
|
|
|
|
echo "Usage: $0 [-a] [-c] [-b] [-r]" 1>&2
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while getopts "bacr:d" o; do
|
|
|
|
@ -114,7 +111,7 @@ while getopts "bacr:d" o; do
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
|
|
|
|
|
|
if [ "$DEBUG" = "true" ]; then
|
|
|
|
|
debugInfo
|
|
|
|
|