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