.drone.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. kind: pipeline
  2. name: default
  3. clone:
  4. skip_verify: true
  5. volumes:
  6. - name: output
  7. host:
  8. path: /var/www/Api.Projects
  9. steps:
  10. - name: build and publish
  11. image: mcr.microsoft.com/dotnet/core/sdk:3.1
  12. volumes:
  13. - name: output
  14. path: /output
  15. environment:
  16. GitApiEndpoint:
  17. from_secret: GitApiEndpoint
  18. GitApiToken:
  19. from_secret: GitApiToken
  20. commands:
  21. - chmod +x ./build.sh
  22. - ./build.sh
  23. - sed -i "s/<GitApiEndpoint>/$GitApiEndpoint/g" output/appsettings.json
  24. - sed -i "s/<GitApiToken>/$GitApiToken/g" output/appsettings.json
  25. - cp api.projects.service output/
  26. - cp -r ./output/* /output
  27. - name: restart service
  28. privileged: true
  29. image: appleboy/drone-ssh
  30. settings:
  31. host: 192.168.1.3
  32. username:
  33. from_secret: ssh_user
  34. password:
  35. from_secret: ssh_password
  36. script:
  37. - systemctl daemon-reload
  38. - service api.projects restart
  39. - name: notify
  40. image: drillster/drone-email
  41. settings:
  42. host: 192.168.1.3
  43. skip_verify: true
  44. from: build@robware.uk
  45. when:
  46. status:
  47. - changed
  48. - failure