2019-05-22 01:24:57 +02:00
|
|
|
# This file is a template, and might need editing before it works on your project.
|
|
|
|
# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
|
|
|
|
|
|
|
|
# you can delete this line if you're not using Docker
|
2019-08-08 08:16:51 +02:00
|
|
|
image: bash:latest
|
2019-05-22 01:24:57 +02:00
|
|
|
|
2019-08-08 08:42:43 +02:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- deploy
|
|
|
|
- restart
|
|
|
|
|
2019-08-08 07:05:31 +02:00
|
|
|
build:datapacks:
|
2019-05-22 01:24:57 +02:00
|
|
|
stage: build
|
|
|
|
script:
|
2019-05-23 20:10:27 +02:00
|
|
|
- apk add --no-cache zip
|
2019-07-31 02:27:22 +02:00
|
|
|
- cd datapacks
|
2019-05-22 02:14:41 +02:00
|
|
|
- mkdir out
|
2019-05-22 03:51:00 +02:00
|
|
|
- find -maxdepth 1 -type d -not -name ".git" -not -name "out" -not -name "." | xargs -I '{}' sh -c 'cd {} && zip -r ../out/{} .'
|
2019-07-31 02:51:45 +02:00
|
|
|
|
2019-05-22 02:14:41 +02:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2019-07-31 02:27:22 +02:00
|
|
|
- ./datapacks/out
|
2019-08-08 07:05:31 +02:00
|
|
|
only:
|
|
|
|
changes:
|
|
|
|
- datapacks/**/*
|
|
|
|
- datapacks/*
|
|
|
|
- .gitlab-ci.yml
|
|
|
|
|
|
|
|
build:resourcepack:
|
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- apk add --no-cache zip
|
|
|
|
|
|
|
|
- cd resourcepack
|
|
|
|
- mkdir -p ../resourcepack-out
|
|
|
|
- zip -r ../resourcepack-out/resourcepack .
|
|
|
|
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- ./resourcepack-out
|
|
|
|
only:
|
|
|
|
changes:
|
|
|
|
- resourcepack/**/*
|
|
|
|
- resourcepack/*
|
|
|
|
- .gitlab-ci.yml
|
2019-05-23 20:08:47 +02:00
|
|
|
|
2019-08-08 07:24:52 +02:00
|
|
|
deploy:datapacks:
|
2019-05-23 20:08:47 +02:00
|
|
|
stage: deploy
|
|
|
|
script:
|
2019-08-08 07:24:52 +02:00
|
|
|
- 'which ssh-agent || ( apk add --no-cache openssh-client )'
|
|
|
|
- apk add --no-cache rsync
|
2019-05-23 20:36:46 +02:00
|
|
|
|
2019-08-08 07:24:52 +02:00
|
|
|
- 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
|
2019-05-23 21:29:22 +02:00
|
|
|
|
2019-08-08 07:24:52 +02:00
|
|
|
- cd datapacks
|
2019-08-08 08:00:23 +02:00
|
|
|
- rsync --dry-run -avz out/ "$SERVER_HOST":"$WPD_FOLDER/world/datapacks" --delete --exclude bukkit
|
2019-08-08 07:24:52 +02:00
|
|
|
|
|
|
|
- ssh "$SERVER_HOST" mcrcon -H localhost -p minecraft "minecraft:reload"
|
2019-08-26 11:13:57 +02:00
|
|
|
needs:
|
|
|
|
- build:datapacks
|
2019-07-31 12:08:01 +02:00
|
|
|
|
2019-05-23 21:11:27 +02:00
|
|
|
only:
|
2019-08-08 07:24:52 +02:00
|
|
|
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
|
|
|
|
|
2019-08-08 07:46:45 +02:00
|
|
|
- cd resourcepack-out
|
2019-08-08 08:00:23 +02:00
|
|
|
- SHASUM=$(sha1sum resourcepack.zip | awk '{ print $1 }')
|
2019-08-08 08:36:26 +02:00
|
|
|
- ssh "$SERVER_HOST" sed -i "s/resource-pack-sha1=.*/resource-pack-sha1=$SHASUM/" "$WPD_FOLDER/server.properties"
|
2019-08-26 11:13:57 +02:00
|
|
|
needs:
|
|
|
|
- build:resourcepack
|
2019-08-08 07:24:52 +02:00
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- master
|
|
|
|
changes:
|
|
|
|
- resourcepack/**/*
|
|
|
|
- resourcepack/*
|
|
|
|
- .gitlab-ci.yml
|
2019-08-18 04:29:47 +02:00
|
|
|
|
|
|
|
pages:
|
|
|
|
stage: deploy
|
|
|
|
script:
|
|
|
|
- mkdir public
|
|
|
|
- mv resourcepack-out/resourcepack.zip public/dodsorfas_resources.zip
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- master
|
|
|
|
changes:
|
|
|
|
- resourcepack/**/*
|
|
|
|
- resourcepack/*
|
|
|
|
- .gitlab-ci.yml
|
2019-08-26 11:13:57 +02:00
|
|
|
needs:
|
2019-08-26 11:58:18 +02:00
|
|
|
- build:resourcepack
|
2019-08-18 04:29:47 +02:00
|
|
|
|
|
|
|
|
2019-08-08 08:42:43 +02:00
|
|
|
|
|
|
|
restart:
|
|
|
|
stage: restart
|
|
|
|
|
|
|
|
script:
|
2019-08-15 20:43:34 +02:00
|
|
|
- echo RESTARTING
|
2019-08-08 08:42:43 +02:00
|
|
|
- '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
|
|
|
|
|
2019-08-08 08:59:34 +02:00
|
|
|
- ssh "$SERVER_HOST" mcrcon -H localhost -p minecraft "save-all restart"
|
2019-08-08 08:42:43 +02:00
|
|
|
|
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- master
|
|
|
|
changes:
|
|
|
|
- resourcepack/**/*
|
|
|
|
- resourcepack/*
|
2019-08-26 11:13:57 +02:00
|
|
|
- .gitlab-ci.yml
|
|
|
|
needs:
|
|
|
|
- deploy:resourcepack
|
|
|
|
- deploy:datapacks
|