From cfeee8b95fc96c8c8be6d4e97c04f85c7c52850b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8A=E5=AE=98=E6=98=93=E6=B3=BD?= <15837994614@163.com> Date: Sat, 7 Aug 2021 15:28:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC17=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/maven.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7e8a184..5957f73 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -34,4 +34,20 @@ jobs: # 上传 docker 镜像 - name: Push image to aliyun docker image registry run: docker push registry.cn-hangzhou.aliyuncs.com/yvam0910/demo_actions:0.1 - \ No newline at end of file + + + # # 连接到远程服务器 + - name: Connect to server + uses: webfactory/ssh-agent@v0.4.1 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + # 初始化 knownhosts + - name: Setup knownhosts + run: ssh-keyscan {{ 42.194.141.181 }} >> ~/.ssh/known_hosts + + # # 触发服务器部署脚本 + - name: Trigger server deployment script + run: ssh root@{{ 42.194.141.181 }} "sh {{ 1.sh }}" + +