geekbot/.gitlab-ci.yml

67 lines
1.7 KiB
YAML
Raw Normal View History

2018-08-28 22:32:24 +02:00
stages:
- build
- ops
2018-08-28 22:32:24 +02:00
- deploy
before_script:
- set -e
- set -u
- set -o pipefail
build:
stage: build
2020-02-08 15:32:58 +01:00
image: mcr.microsoft.com/dotnet/core/sdk:3.1
2018-08-28 22:32:24 +02:00
artifacts:
expire_in: 1h
paths:
- Geekbot.net/Binaries/
script:
- dotnet restore
2018-08-28 22:32:24 +02:00
- dotnet test Tests
- dotnet publish --version-suffix ${CI_COMMIT_SHA:0:8} --configuration Release -o ./Geekbot.net/Binaries ./Geekbot.net/
2018-08-28 22:32:24 +02:00
sentry:
stage: ops
image: getsentry/sentry-cli
allow_failure: true
only:
- master
dependencies:
- build
script:
2020-06-19 04:13:26 +02:00
- sentry-cli releases new -p geekbot 4.2.0-${CI_COMMIT_SHA:0:8}
- sentry-cli releases set-commits --auto 4.2.0-${CI_COMMIT_SHA:0:8}
- sentry-cli releases deploys 4.2.0-${CI_COMMIT_SHA:0:8} new -e Production
2018-08-28 22:32:24 +02:00
deploy:
stage: deploy
2018-08-29 22:49:13 +02:00
image: runebaas/rsync-ssh-git
2018-08-28 22:32:24 +02:00
only:
- master
dependencies:
- build
- sentry
2018-08-28 22:32:24 +02:00
environment:
name: Production
url: https://discordapp.com/oauth2/authorize?client_id=171249478546882561&scope=bot&permissions=1416834054
before_script:
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n StrictHostKeyChecking no" > ~/.ssh/config'
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- chmod 700 ~/.ssh
script:
2019-02-13 01:06:05 +01:00
- rsync -rav -e "ssh -p 65432" ./Geekbot.net/Binaries/* geekbot@$DEPIP:$DEPPATH
- ssh -p 65432 geekbot@$DEPIP "sudo systemctl restart geekbot.service"
2018-08-28 22:32:24 +02:00
mirror:
stage: deploy
2018-08-29 22:49:13 +02:00
image: runebaas/rsync-ssh-git
2018-08-28 22:32:24 +02:00
only:
- master
dependencies:
- build
- sentry
2018-08-28 22:32:24 +02:00
script:
- git push https://runebaas:$TOKEN@github.com/pizzaandcoffee/Geekbot.net.git origin/master:master -f