From 5eb52e121e8e56f6be3340fabe9c04265a2078e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Thu, 8 Aug 2019 06:42:43 +0000 Subject: [PATCH] Update .gitlab-ci.yml --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe6f123..78caf3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,12 @@ # you can delete this line if you're not using Docker image: bash:latest +stages: + - build + - test + - deploy + - restart + build:datapacks: stage: build script: @@ -89,3 +95,26 @@ deploy:resourcepack: - resourcepack/**/* - resourcepack/* - .gitlab-ci.yml + +restart: + stage: restart + + script: + - 'which ssh-agent || ( apk add --no-cache openssh-client )' + + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + + - ssh "$SERVER_HOST" mcrcon -H localhost -p minecraft "minecraft:say SERVER RESTART IN 2 MINUTES" + + only: + refs: + - master + changes: + - resourcepack/**/* + - resourcepack/* + - .gitlab-ci.yml \ No newline at end of file