This commit is contained in:
toom1996
2026-10-20 23:13:06 +08:00
2 changed files with 20 additions and 0 deletions

View File

@ -1,13 +1,17 @@
name: deploy name: deploy
on: on:
<<<<<<< HEAD
# 手动触发:在 Gitea 仓库 Actions 页面点「Run workflow」才部署, # 手动触发:在 Gitea 仓库 Actions 页面点「Run workflow」才部署,
# 避免每次 push 到 main 的半成品代码被自动上线。 # 避免每次 push 到 main 的半成品代码被自动上线。
=======
>>>>>>> 98284c59e89856adf5a09ec675185b157e98d442
workflow_dispatch: workflow_dispatch:
jobs: jobs:
deploy: deploy:
runs-on: docker runs-on: docker
steps: steps:
<<<<<<< HEAD
- name: SSH 到服务器执行上线脚本 - name: SSH 到服务器执行上线脚本
uses: appleboy/ssh-action@v1 uses: appleboy/ssh-action@v1
with: with:
@ -17,3 +21,19 @@ jobs:
script: | script: |
cd /opt/fashion/test cd /opt/fashion/test
./deploy.sh ./deploy.sh
=======
- name: SSH deploy
shell: sh
env:
KEY_B64: ${{ secrets.DEPLOY_KEY_B64 }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
run: |
set -e
apk add --no-cache openssh-client >/dev/null 2>&1 || true
mkdir -p "$HOME/.ssh"
echo "$KEY_B64" | base64 -d > "$HOME/.ssh/id"
chmod 600 "$HOME/.ssh/id"
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i "$HOME/.ssh/id" \
"$DEPLOY_USER@$DEPLOY_HOST" "cd /opt/fashion/backend_v2 && ./deploy.sh backend"
>>>>>>> 98284c59e89856adf5a09ec675185b157e98d442

0
deploy.sh Normal file → Executable file
View File