geekbot/.gitlab-ci.yml

70 lines
1.6 KiB
YAML
Raw Permalink Normal View History

2018-08-28 22:32:24 +02:00
stages:
- build
2020-06-19 22:20:05 +02:00
- docker
2018-08-28 22:32:24 +02:00
- deploy
2020-06-19 22:20:05 +02:00
- ops
2018-08-28 22:32:24 +02:00
variables:
2022-07-22 19:47:46 +02:00
VERSION: 4.4.0-V$CI_COMMIT_SHORT_SHA
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
2020-06-20 00:43:59 +02:00
2020-06-19 22:20:05 +02:00
Build:
2018-08-28 22:32:24 +02:00
stage: build
2021-03-19 00:21:35 +01:00
image: mcr.microsoft.com/dotnet/sdk:6.0
2018-08-28 22:32:24 +02:00
artifacts:
expire_in: 1h
paths:
2020-06-19 22:20:05 +02:00
- app
2018-08-28 22:32:24 +02:00
script:
- dotnet restore
- dotnet test tests
- dotnet publish --version-suffix "$VERSION" -r linux-x64 -c Release -p:DebugType=embedded --no-self-contained -o ./app ./src/Startup/
2018-08-28 22:32:24 +02:00
2020-06-19 22:20:05 +02:00
Package:
stage: docker
image: docker
2020-06-20 00:43:59 +02:00
only:
- master
2020-06-19 22:20:05 +02:00
services:
- docker:stable-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
2020-06-19 22:20:05 +02:00
Deploy:
2018-08-28 22:32:24 +02:00
stage: deploy
image: quay.io/ansible/ansible-runner:stable-2.12-latest
2018-08-28 22:32:24 +02:00
only:
- master
2020-06-20 00:43:59 +02:00
variables:
ANSIBLE_NOCOWS: 1
2018-08-28 22:32:24 +02:00
before_script:
2020-06-20 00:43:59 +02:00
- mkdir /root/.ssh
- cp $SSH_PRIVATE_KEY /root/.ssh/id_ed25519
- cp $SSH_PUBLIC_KEY /root/.ssh/id_ed25519.pub
- chmod -R 600 /root/.ssh
- ssh-keyscan -p 65432 $PROD_IP > /root/.ssh/known_hosts
2018-08-28 22:32:24 +02:00
script:
- ansible-galaxy collection install -r ansible-requirements.yml
2020-06-20 00:43:59 +02:00
- ansible-playbook -i $PROD_IP, .deploy.yml
2018-08-28 22:32:24 +02:00
2020-06-19 22:20:05 +02:00
Sentry:
stage: ops
image: getsentry/sentry-cli
allow_failure: true
only:
- master
script:
- sentry-cli releases new -p geekbot $VERSION
- sentry-cli releases set-commits --auto $VERSION
- sentry-cli releases deploys $VERSION new -e Production
2020-06-19 22:20:05 +02:00
Github Mirror:
stage: ops
2018-08-29 22:49:13 +02:00
image: runebaas/rsync-ssh-git
2018-08-28 22:32:24 +02:00
only:
- master
script:
- git push https://runebaas:$TOKEN@github.com/pizzaandcoffee/Geekbot.net.git origin/master:master -f