20 lines
363 B
Bash
Executable File
20 lines
363 B
Bash
Executable File
#!/bin/bash
|
|
host="root@main"
|
|
|
|
# 更新 go mod, 然後靜態編譯
|
|
go mod tidy
|
|
go build -o dist/main bin/main.go
|
|
|
|
# 重命名旧文件
|
|
ssh $host "mv ~/webp/main ~/webp/main_old"
|
|
|
|
# 上传到服务器, 然後刪除本地文件
|
|
scp dist/main $host:~/webp/main
|
|
rm -rf dist
|
|
|
|
# 重载服务
|
|
ssh $host "pm2 reload webp"
|
|
|
|
# 删除旧文件
|
|
ssh $host "rm ~/webp/main_old"
|