From d9aac0fbd8464fb3cd1b48f3ba773125ff6ae4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=B5=B7?= Date: Sun, 1 Dec 2019 13:28:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afae0bf..7e6b452 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ cache: stages: - test - - build + - deploy test: @@ -14,8 +14,17 @@ test: script: - cp "$APP_TEST" ./src/main/resources/application-test.properties - mvn test -build: - stage: build + +deploy: + stage: deploy script: - cp "$APP_PROD" ./src/main/resources/application-prod.properties - mvn package -DskipTests + - eval $(ssh-agent -s) + - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 --decode) + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - ssh-keyscan celess.cn >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + - scp target/blog-0.0.1-SNAPSHOT.jar root@celess.cn:/www/wwwroot/api.celess.cn + - ssh root@celess.cn "cd /www/wwwroot/api.celess.cn && bash build.sh" \ No newline at end of file