Files
web_huangguo_web/app/deploy_prod.sh
T
fish03andClaude Opus 5.5 bef9f8b4ed Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 14:43:16 +07:00

34 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
FILE_NAME="web_cgdj_h5"
REMOTE_FILE_PATH="/home/server2/web_cgdj/h5/"
TAG_NAME="web_cgdj_h5.tar.gz"
set -e
set -o
function send_msg() {
msg="@jscdsndj @xiuyuan_Lee @steven0yu %0A服务:SERVER2  站点-cgdj-H5 %0A更新内容:$content%0A创建时间: $(date +%F_%X)%0A操作人:$(git config user.name)"
curl -X POST "https://api.telegram.org/bot6357085965:AAEmXfjZnZwnDTicL7Wjbd7cXvYv_G98w8A/sendMessage" -d "chat_id=$1&text=$msg" >/dev/null 2>&1
}
read -p "输入yes, 开始上传: " word
if [[ ! "yes" =~ $word ]]; then
echo "终止"
else
read -e -p "本次更新内容(输入q退出编辑): " -r content
echo "开始"
rm -rf ./$FILE_NAME ./$TAG_NAME ./yinsemd5.txt
GOOS=linux GOARCH=amd64 go build -o $FILE_NAME
md5sum $FILE_NAME | cut -d ' ' -f1 >yinsemd5.txt
# 排除 app 定时生成的 SEO 静态文件,避免覆盖服务器上已有 sitemap/rss/llms
tar zvcf $TAG_NAME ./$FILE_NAME templates/ static/ yinsemd5.txt \
--exclude='templates/page/sitemaps/sitemap.xml' \
--exclude='templates/page/sitemaps/sitemap-*.xml' \
--exclude='templates/page/rss.xml' \
--exclude='templates/page/llms.txt' \
--exclude='templates/page/llms-full.txt'
md5sum $TAG_NAME | cut -d ' ' -f1 >yinsemd5.txt
scp -i ~/.ssh/id_rsa -P 22889 ./yinsemd5.txt server2@116.212.120.2:$REMOTE_FILE_PATH
scp -i ~/.ssh/id_rsa -P 22889 ./$TAG_NAME server2@116.212.120.2:$REMOTE_FILE_PATH
send_msg -4791758991 #服务器小组
fi
rm -rf ./$FILE_NAME ./$TAG_NAME ./yinsemd5.txt