.drone.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. kind: pipeline
  2. name: default
  3. type:
  4. steps:
  5. - name: build
  6. image: maven:3.8.1-openjdk-8
  7. volumes:
  8. - name: cache # The Volume's name
  9. path: /root/.m2 # The path in the container
  10. commands:
  11. #- mvn help:effective-settings # check maven
  12. - ls -hl /root/.m2/
  13. - mvn -version
  14. - java -version
  15. - mvn help:effective-settings
  16. - mvn clean package -DskipTests
  17. - pwd
  18. - ls -hl
  19. - ls -hl railway-admin
  20. - ls -hl railway-admin/target
  21. #- name: docker
  22. # image: plugins/docker
  23. # volumes:
  24. # - name: dockersock
  25. # path: /var/run/docker.sock
  26. ## settings:
  27. # username: iamsee
  28. # password: zhuotong
  29. # from_secret: zhuotong
  30. # debug: true
  31. # launch_debug: true
  32. #insecure: true
  33. # mirror: https://mgjrzxtn.mirror.aliyuncs.com
  34. # #registry: 192.168.1.100:10000
  35. # repo: iamsee/railway-admin
  36. # purge: true
  37. # tags:
  38. # - ${DRONE_COMMIT_SHA:1.0.0}
  39. # - ${DRONE_COMMIT}
  40. # - v1
  41. # - latest
  42. - name: scp_files
  43. image: appleboy/drone-scp
  44. settings:
  45. host: deploy.iamsee.com
  46. username: root
  47. password: $jgkj001
  48. debug: true
  49. target: /tmp/jar
  50. source: railway-admin/target/railway-admin.jar
  51. - name: deploy
  52. image: appleboy/drone-ssh
  53. settings:
  54. host: deploy.iamsee.com
  55. username: root
  56. password: $jgkj001
  57. debug: true
  58. script:
  59. - export PATH=/usr/local/bin:$PATH
  60. - echo $PATH
  61. # - a=`docker ps -a | grep "railway-admin" | awk '{print $1 }'` && [[ ${#a} -ne "" ]] && docker stop "${a}" && docker rm "${a}"
  62. - export has=`docker ps -a | grep "railway-admin$" | wc -l`
  63. - export id=`docker ps -a | grep "railway-admin$" | awk '{print $1 }'`
  64. - echo $has && echo $id && if [[ has -gt 0 ]] ; then docker stop $id && docker rm $id ; fi;
  65. - docker image rm iamsee/railway-admin
  66. - docker run -itd --name railway-admin -p 2021:2021 iamsee/railway-admin:latest
  67. volumes:
  68. - name: cache # The name use in this pipeline,
  69. host:
  70. path: /tmp/cache # The path be used in the host.
  71. - name: dockersock
  72. host:
  73. path: /var/run/docker.sock