[root@crimson home]# pwd
/home
[root@crimson home]# tree -L 2
.
|-- halo
| |-- CHANGELOG.md
| |-- CONTRIBUTING.md
| |-- Dockerfile
| |-- LICENSE
| |-- README.md
| |-- SECURITY.md
| |-- build
| |-- build.gradle
| |-- config
| |-- gradle
| |-- gradlew
| |-- gradlew.bat
| |-- settings.gradle
| `-- src
|-- halo-admin
| |-- LICENSE
| |-- README.md
| |-- babel.config.js
| |-- dist
| |-- jsconfig.json
| |-- node_modules
| |-- package-lock.json
| |-- package.json
| |-- postcss.config.js
| |-- public
| |-- src
| |-- tailwind.config.js
| |-- vue.config.js
| `-- yarn.lock
|-- shadowsock
|-- user
`-- www
|-- application.yaml
|-- halo-1.3.2.jar
|-- halo-1.4.3.jar
|-- halo.jar
|-- log1
`-- log2
13 directories, 26 files
::echo off
echo '上传到云服务器'
scp -vrp -P 22 C:\Users\ljj\Documents\WorkSpace\MY\halo\autoDeploy.sh root@crimson.chat:/home/deploy
ssh root@crimson.chat chmod a+x /home/deploy
#!/bin/bash
#这里可替换为你自己的执行程序,其他代码无需更改
APP_NAME=halo
#使用说明,用来提示输入参数
usage() {
echo "Usage: sh 脚本名.sh [start|stop|restart|status]"
exit 1
}
#检查程序是否在运行
is_exist(){
pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' `
#如果不存在返回1,存在返回0
if [ -z "${pid}" ]; then
return 1
else
return 0
fi
}
#启动方法
start(){
is_exist
if [ $? -eq "0" ]; then
echo "${APP_NAME} is already running. pid=${pid} ."
else
cp log log
nohup java -Xmx512m -Xms512m -jar $APP_NAME > log 2>&1 &
echo "${APP_NAME} start success"
fi
}
#停止方法
stop(){
is_exist
if [ $? -eq "0" ]; then
kill -9 $pid
else
echo "${APP_NAME} is not running"
fi
}
#输出运行状态
status(){
is_exist
if [ $? -eq "0" ]; then
echo "${APP_NAME} is running. Pid is ${pid}"
else
echo "${APP_NAME} is NOT running."
fi
}
#重启
restart(){
stop
start
}
fetch() {
if command -v git >/dev/null 2>&1; then
echo 'exists git'
else
echo 'no exists git'
yum install git
fi
git clone https://github.com/1357885013/halo.git
git clone https://github.com/1357885013/halo-admin.git
cd /home/halo
git fetch
cd /home/halo-admin
git fetch
}
build(){
yarn
npm install -g yarn
yum install npm
yarn build
rm -rf halo/src/main/resources/admin/*
cp -rf halo-admin/dist/* halo/src/main/resources/admin/
cd halo
./gradlew build -x test
rm -rf www/halo-1.4.11.jar
cp -rf halo/build/libs/halo-1.4.11.jar www/
}
#根据输入参数,选择执行对应方法,不输入则执行使用说明
case "$1" in
"start")
start
;;
"stop")
stop
;;
"status")
status
;;
"restart")
restart
;;
"main")
stop
fetch
build
start
;;
*)
usage
;;
esac
服务器性能低的话编译会卡死,丐版不要轻易尝试
1.
提交github
2.
GitHub请求接口
3.
后台 开进程 运行命令
4.
编译,
#!/bin/sh
echo "+++++++++++++++++++STARTING SCP TRANSFER+++++++++++++++++++"
if [[ "$INPUT_KEY" ]]; then
echo -e "${INPUT_KEY}" > tmp_id
chmod 600 tmp_id
scp -qr -P $INPUT_PORT -o StrictHostKeyChecking=no -i tmp_id $INPUT_SOURCE "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_TARGET"
echo "Transfer process complete using SSH keys"
else
echo "Trying password authentication as key is not available"
sshpass -p $INPUT_PASSWORD scp -qr -P $INPUT_PORT -o StrictHostKeyChecking=no $INPUT_SOURCE "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_TARGET"
echo "Transfer process complete using password"
fi
echo "+++++++++++++++++++END+++++++++++++++++++"
#!/bin/bash
set -eu
SSHPATH="$HOME/.ssh"
mkdir -p "$SSHPATH"
echo "$DEPLOY_KEY" > "$SSHPATH/key"
chmod 600 "$SSHPATH/key"
SERVER_DEPLOY_STRING="$USERNAME@$SERVER_IP:$SERVER_DESTINATION"
# sync it up"
sh -c "rsync $ARGS -e 'ssh -i $SSHPATH/key -o StrictHostKeyChecking=no -p $SERVER_PORT' $GITHUB_WORKSPACE/$FOLDER $SERVER_DEPLOY_STRING"
name: Needs More Info Closer
on:
schedule:
- cron: 20 11 * * * # 4:20am Redmond
repository_dispatch:
types: [trigger-needs-more-info]
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
uses: actions/checkout@v2
with:
repository: "microsoft/vscode-github-triage-actions"
path: ./actions
ref: stable
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Run Needs More Info Closer
uses: ./actions/needs-more-info-closer
with:
token: ${{secrets.ISSUE_TRIAGE_BOT_PAT}}
label: needs more info
closeDays: 7
additionalTeam: "ruibaby|JohnNiang|guqing|LIlGG|halo-dev-bot"
closeComment: "此问题已自动关闭,因为它需要更多信息且最近没有活跃。"
pingDays: 80
pingComment: "Hey @${assignee}, 这个问题可能需要进一步关注。\n\n@${author}, 如果问题不再存在,您可以帮助我们关闭此问题,或者添加更多信息。"
- name: deploy to server
uses: AEnterprise/rsync-deploy@v1.0
env:
DEPLOY_KEY: ${{ secrets.SERVER_SSH_KEY }}
ARGS: "-e -c -r --delete"
SERVER_PORT: ${{ secrets.SERVER_PORT }}
FOLDER: "./"
SERVER_IP: ${{ secrets.SERVER_IP }}
USERNAME: ${{ secrets.USERNAME }}
SERVER_DESTINATION: ${{ secrets.SERVER_DESTINATION }
评论区