.drone.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. AuthEndpoint:
  21. from_secret: AuthEndpoint
  22. AuthApiKey:
  23. from_secret: AuthApiKey
  24. commands:
  25. - chmod +x ./build.sh
  26. - ./build.sh
  27. - sed -i "s/<GitApiEndpoint>/$GitApiEndpoint/g" output/appsettings.json
  28. - sed -i "s/<GitApiToken>/$GitApiToken/g" output/appsettings.json
  29. - sed -i "s/<AuthEndpoint>/$AuthEndpoint/g" output/appsettings.json
  30. - sed -i "s/<AuthApiKey>/$AuthApiKey/g" output/appsettings.json
  31. - cp api.projects.service output/
  32. - cp -r ./output/* /output
  33. - name: restart service
  34. privileged: true
  35. image: appleboy/drone-ssh
  36. settings:
  37. host: 192.168.1.3
  38. username:
  39. from_secret: ssh_user
  40. password:
  41. from_secret: ssh_password
  42. script:
  43. - systemctl daemon-reload
  44. - service api.projects restart
  45. - name: notify
  46. image: drillster/drone-email
  47. settings:
  48. host: 192.168.1.3
  49. skip_verify: true
  50. from: build@robware.uk
  51. when:
  52. status:
  53. - changed
  54. - failure