diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6068ee1..6efb848 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,27 +39,56 @@ build:resourcepack: - resourcepack/* - .gitlab-ci.yml -deploy: +deploy:datapacks: stage: deploy script: - - ls -alh . ./datapacks -# - 'which ssh-agent || ( apk add --no-cache openssh-client )' -# - apk add --no-cache rsync + - 'which ssh-agent || ( apk add --no-cache openssh-client )' + - apk add --no-cache rsync -# - 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 -# -# - cd datapacks -# - rsync -avz out/ "$SERVER_HOST":"$WPD_FOLDER" --delete --exclude bukkit + - 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:reload" + - cd datapacks + - rsync -avz out/ "$SERVER_HOST":"$WPD_FOLDER" --delete --exclude bukkit + + - ssh "$SERVER_HOST" mcrcon -H localhost -p minecraft "minecraft:reload" -# - cd ../resourcepack-out -# - sha1sum resourcepack.zip + - cd ../resourcepack-out + - sha1sum resourcepack.zip only: - - master + refs: + - master + changes: + - datapacks/**/* + - datapacks/* + - .gitlab-ci.yml + +deploy:resourcepack: + stage: deploy + script: + - 'which ssh-agent || ( apk add --no-cache openssh-client )' + - apk add --no-cache rsync + + - 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 + + - cd ../resourcepack-out + - shasum= $(sha1sum resourcepack.zip | awk '{ print $1 }' + - ssh "$SERVER_HOST" mcrcon -H localhost -p minecraft "minecraft:say Server restart in 2 minutes" + + only: + refs: + - master + changes: + - resourcepack/**/* + - resourcepack/* + - .gitlab-ci.yml