build.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: Publish Installers
  2. on:
  3. workflow_dispatch: ~
  4. push:
  5. branches: [master]
  6. tags: [v*]
  7. jobs:
  8. build:
  9. name: Build ${{ matrix.os }} Package
  10. runs-on: ${{ matrix.os }}
  11. strategy:
  12. matrix:
  13. os: [ubuntu-20.04, windows-latest]
  14. steps:
  15. - name: Checkout Code
  16. uses: actions/checkout@v4
  17. - name: Set Release Version
  18. id: get_version
  19. shell: bash
  20. run: |
  21. echo "::set-output name=hash::$(git rev-parse --short HEAD)"
  22. echo "::set-output name=date::$(date +%Y%m%d)"
  23. echo "::set-output name=url::$(git remote get-url origin)"
  24. - name: Set Up Python
  25. uses: actions/setup-python@v4
  26. with:
  27. python-version: '3.9'
  28. cache: pip
  29. cache-dependency-path: '**/requirements*.txt'
  30. - name: Install Dependencies
  31. run: |
  32. python -m pip install --upgrade pip wheel setuptools
  33. pip install -r requirements.txt
  34. python -m pip install pyinstaller
  35. - name: Build Package
  36. run: |
  37. python -m PyInstaller fgh.spec
  38. python -m PyInstaller fgh-server.spec
  39. cp .env ./dist && cp -R scripts/* ./dist
  40. - name: Archive linux Package
  41. if: ${{ runner.os == 'Linux' }}
  42. run: |
  43. tar -zcvf fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.tar.gz dist/*
  44. find dist/ -type f -delete
  45. mv fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.tar.gz dist
  46. - name: Archive Windows Package
  47. if: ${{ runner.os == 'Windows' }}
  48. run: |
  49. 7z a -r fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.zip ./dist
  50. Remove-Item -Path dist -Recurse -Force
  51. mkdir dist && mv fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.zip dist
  52. - name: Update to ali oss
  53. uses: yizhoumo/setup-ossutil@v1
  54. with:
  55. endpoint: oss-cn-qingdao.aliyuncs.com
  56. access-key-id: ${{ secrets.OSS_KEY_ID }}
  57. access-key-secret: ${{ secrets.OSS_KEY_SECRET }}
  58. - name: cp files to aliyun
  59. run: |
  60. ossutil cp -r dist/ oss://yoqi-software/develop/fgh/${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}/
  61. - uses: leafney/dingtalk-action@v1
  62. if: always()
  63. env:
  64. DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }}
  65. with:
  66. msgtype: link
  67. title: 'fgh build success'
  68. text: 'please download from aliyun oss. [git.yoqi.me]'
  69. msg_url: '${{ steps.get_version.outputs.url }}'