You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.1 KiB

  1. name: devops-test
  2. on:
  3. push:
  4. branches: [test]
  5. workflow_dispatch:
  6. jobs:
  7. build:
  8. name: Build
  9. runs-on: ubuntu-latest
  10. strategy:
  11. matrix:
  12. node-version: ['16.x']
  13. go-version: ['1.16']
  14. steps:
  15. - name: Check out branch
  16. uses: actions/checkout@v2
  17. - name: Sed Config
  18. env:
  19. PROD: ${{ secrets.PROD }}
  20. TESTING: ${{ secrets.TESTING }}
  21. shell: bash
  22. run: |
  23. git branch
  24. ls -l
  25. sed -i "s/${PROD}/${TESTING}/g" web/.env.production
  26. sed -i 's/${basePath}:${basePort}/${basePath}/g' web/src/view/systemTools/formCreate/index.vue
  27. - name: Use Node.js ${{ matrix.node-version }}
  28. uses: actions/setup-node@v2.1.2
  29. with:
  30. node-version: ${{ matrix.node-version }}
  31. - name: Build-Node
  32. run: |
  33. cd web/ && yarn install && yarn run build
  34. - name: Use Go ${{ matrix.go-version }}
  35. uses: actions/setup-go@v1
  36. with:
  37. go-version: ${{ matrix.go-version }}
  38. - name: Build-go
  39. run: |
  40. cd server/ && go mod tidy && go build && mkdir ../web/ser && mv server ../web/ser/ && cd ../web/ser/ && ls -s
  41. - name: restart
  42. env:
  43. KEY: ${{ secrets.KEY }}
  44. HOST: ${{ secrets.HOST }}
  45. USER: ${{ secrets.USER }}
  46. PROT: ${{ secrets.PROT }}
  47. MKDIRTEST: ${{ secrets.MKDIRTEST }}
  48. run: |
  49. mkdir -p ~/.ssh/ && echo "$KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
  50. ssh-keyscan github.com >> ~/.ssh/known_hosts
  51. scp -P ${PROT} -o StrictHostKeyChecking=no -r web/dist/* ${USER}@${HOST}:${MKDIRTEST}dist/
  52. scp -P ${PROT} -o StrictHostKeyChecking=no -r web/ser/* ${USER}@${HOST}:${MKDIRTEST}
  53. ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIRTEST}resource/ && rm -rf ${MKDIRTEST}resource/*"
  54. scp -P ${PROT} -o StrictHostKeyChecking=no -r server/resource/* ${USER}@${HOST}:${MKDIRTEST}resource/
  55. ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIRTEST} && bash restart.sh > /dev/null 2>&1 &"