diff --git a/.drone.yml b/.drone.yml index 0c08613..866ea99 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,6 +6,13 @@ steps: - name: build image: mcr.microsoft.com/dotnet/sdk:7.0 commands: + - apt-get update + - apt-get install --yes openjdk-11-jre + - dotnet tool install --global dotnet-sonarscanner + - export PATH="$PATH:$HOME/.dotnet/tools" + - dotnet sonarscanner begin /k:"My-Weather-API" /d:sonar.login="$SONAR_TOKEN" /d:"sonar.host.url=$SONAR_HOST_URL" + - dotnet build + - dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN" - dotnet publish -c Release -o ./publish - name: image @@ -19,6 +26,18 @@ steps: password: from_secret: registry_password + - name: deploy + image: appleboy/drone-ssh + settings: + host: devops.cargostart.tech + port: 2222 + username: swarm + key: + from_secret: swarm_ssh_key + script: + - docker service update --image registry.devops.cargostart.tech/my-weather-api:latest weather_app --with-registry-auth + + trigger: event: - push