build.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.12'
  28. cache: pip
  29. cache-dependency-path: '**/requirements*.txt'
  30. - name: Set up Python dependency cache
  31. uses: actions/cache@v3
  32. with:
  33. path: ~/.cache/pypoetry
  34. key: ${{ runner.os }}-poetry-${{ hashFiles('pyproject.toml') }}-${{ steps.get_date.outputs.date }}
  35. - name: Install Dependencies
  36. run: |
  37. python -m pip install --upgrade pip wheel setuptools poetry
  38. poetry config virtualenvs.in-project true
  39. poetry install
  40. - name: Build Package on Linux
  41. if: matrix.os == 'ubuntu-20.04'
  42. run: |
  43. poetry run python -m PyInstaller search_domain-linux.spec
  44. - name: Build Package on Windows
  45. if: matrix.os == 'windows-latest'
  46. run: |
  47. poetry run python -m PyInstaller search_domain-windows.spec
  48. - name: Update to ali oss
  49. uses: yizhoumo/setup-ossutil@v1
  50. with:
  51. endpoint: oss-cn-qingdao.aliyuncs.com
  52. access-key-id: ${{ secrets.OSS_KEY_ID }}
  53. access-key-secret: ${{ secrets.OSS_KEY_SECRET }}
  54. - name: cp files to aliyun
  55. run: |
  56. ossutil cp -r dist/ oss://yoqi-software/develop/search_domain/${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}/
  57. - uses: leafney/dingtalk-action@v1
  58. if: always()
  59. env:
  60. DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }}
  61. with:
  62. msgtype: link
  63. title: 'search_domain build success'
  64. text: 'please download from aliyun oss. [git.yoqi.me]'
  65. msg_url: '${{ steps.get_version.outputs.url }}'