Skip to content

Commit

Permalink
chore: github 部署脚本更新
Browse files Browse the repository at this point in the history
  • Loading branch information
vaebe committed Jul 13, 2024
1 parent 83d40dd commit 2c946b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ jobs:
- name: Build Go application
run: gf build

- name: Archive build

- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

- name: Archive build - upload
run: |
cd temp/linux_amd64
cd ./linux_amd64
tar -czf main.tar.gz main
scp -o StrictHostKeyChecking=no -P 22 main.tar.gz ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }}:/usr/local/kk/kkdl/main.tar.gz

- name: Deploy to server
uses: appleboy/ssh-action@master
Expand All @@ -44,11 +52,9 @@ jobs:
if [ -e /usr/local/kk/kkdl/main ]; then
mv /usr/local/kk/kkdl/main /usr/local/kk/kkdl/oldman
fi
cd /usr/local/kk/kkdl/
tar -xzf main.tar.gz
sudo systemctl stop myapp
sudo mv main /usr/local/kk/kkdl/
sudo cd /usr/local/kk/kkdl/
sudo sh run.sh
sh run.sh
if [ -e /usr/local/kk/kkdl/oldman ]; then
rm -rf oldman
rm -rf oldman main.tar.gz
fi
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ change_permission() {

# 启动进程
start_process() {
nohup ./main &
nohup ./main --gf.gcfg.file=config.pro.yaml >/dev/null 2>&1 &
echo "部署完成"
}

Expand Down

0 comments on commit 2c946b0

Please sign in to comment.