backend_deploy.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. name: gin-vue-admin backend deploy
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - action-ci
  7. paths:
  8. - './server/**'
  9. paths-ignore:
  10. - './db/**'
  11. pull_request:
  12. branches:
  13. - master
  14. paths:
  15. - './server/**'
  16. paths-ignore:
  17. - './db/**'
  18. jobs:
  19. build:
  20. name: Build
  21. runs-on: [ self-hosted ]
  22. steps:
  23. - name: Check out the repository
  24. uses: actions/checkout@master
  25. - name: Show files
  26. run: |
  27. pwd
  28. ls -la
  29. - name: Get dependencies
  30. run: |
  31. go get -v -t -d ./...
  32. if [ -f Gopkg.toml ]; then
  33. curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  34. dep ensure
  35. fi
  36. working-directory: ./server
  37. - name: Build
  38. run: |
  39. go build -o run -v
  40. working-directory: ./server
  41. - name: Modify config params
  42. run: |
  43. sed -i 's/%{mysql_address}/'$MYSQL_ADDR'/' config.yaml
  44. sed -i 's/%{mysql_username}/'$MYSQL_USERNAME'/' config.yaml
  45. sed -i 's/%{mysql_password}/'$MSQL_PASSWORD'/' config.yaml
  46. sed -i 's/%{redis_address}/'$REDIS_ADDR'/' config.yaml
  47. sed -i 's/%{redis_password}/'$REDIS_PASSWORD'/' config.yaml
  48. working-directory: ./server
  49. deploy:
  50. - name: Run Dockerfile
  51. run: |
  52. echo 'There is nothing for the time being'
  53. working-directory: ./server