优化上传资源脚本

打新包删除旧资源
main
zhangaotian 2024-04-16 15:09:41 +08:00
parent e9cf35287a
commit dd47ce9e95
2 changed files with 7 additions and 2 deletions

@ -1 +1 @@
Subproject commit 0dcb897db3eafc5b1f0c81fe2b72a3dc01404436
Subproject commit 27cb5cb83fbc0861d947b3edf9fa6875269597d1

View File

@ -12,11 +12,12 @@ fi
VERSION="$1"
PLATFORM="$2"
WORKSPACE="$3"
NEWASSETS="$4"
# Set remote server details (modify as needed)
REMOTE_USER="root"
REMOTE_HOST="132.232.113.98"
REMOTE_PATH="/var/www/html/nld/$WORKSPACE/$PLATFORM/$VERSION"
REMOTE_PATH="/var/www/html/nld/NLDAssets/$WORKSPACE/$PLATFORM/$VERSION"
echo "remote path : $REMOTE_PATH"
@ -26,6 +27,10 @@ BUILD_PATH="../../ProjectNLD/ServerData/$PLATFORM/"
# Set the URL where you want to send the message
NOTE_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3c92758c-1128-4931-ac8d-f19669d7befe"
# Check if NEWASSETS is true, if so, delete existing assets on remote server
if [ "$NEWASSETS" = "true" ]; then
ssh "$REMOTE_USER@$REMOTE_HOST" "rm -rf $REMOTE_PATH/*"
fi
tar -czvf upload.tgz -C "$BUILD_PATH" .
ssh "$REMOTE_USER@$REMOTE_HOST" "mkdir -p $REMOTE_PATH"