Compare commits
1 Commits
f582d8d071
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 56e3cfcff7 |
@ -1,27 +1,18 @@
|
|||||||
name: deploy
|
name: deploy
|
||||||
on:
|
on:
|
||||||
<<<<<<< HEAD
|
push:
|
||||||
# 手动触发:在 Gitea 仓库 Actions 页面点「Run workflow」才部署,
|
branches: [main, master]
|
||||||
# 避免每次 push 到 main 的半成品代码被自动上线。
|
|
||||||
=======
|
|
||||||
>>>>>>> 29c2d77a8585ff20a7ed193cd45a7a291c63befe
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
steps:
|
steps:
|
||||||
- name: SSH deploy
|
- name: SSH 到服务器执行上线脚本
|
||||||
shell: sh
|
uses: appleboy/ssh-action@v1
|
||||||
env:
|
with:
|
||||||
KEY_B64: ${{ secrets.DEPLOY_KEY_B64 }}
|
host: ${{ secrets.DEPLOY_HOST }}
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
username: ${{ secrets.DEPLOY_USER }}
|
||||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
key: ${{ secrets.DEPLOY_KEY }}
|
||||||
run: |
|
script: |
|
||||||
set -e
|
cd /opt/fashion/test
|
||||||
apk add --no-cache openssh-client >/dev/null 2>&1 || true
|
./deploy.sh
|
||||||
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 web --no-cache"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user