build.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 install
  39. - name: Build Package
  40. run: |
  41. poetry run python -m PyInstaller -F -c --name search_domain main.py
  42. - name: Update to ali oss
  43. uses: yizhoumo/setup-ossutil@v1
  44. with:
  45. endpoint: oss-cn-qingdao.aliyuncs.com
  46. access-key-id: ${{ secrets.OSS_KEY_ID }}
  47. access-key-secret: ${{ secrets.OSS_KEY_SECRET }}
  48. - name: cp files to aliyun
  49. run: |
  50. ossutil cp -r dist/ oss://yoqi-software/develop/search_domain/${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}/
  51. - uses: leafney/dingtalk-action@v1
  52. if: always()
  53. env:
  54. DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }}
  55. with:
  56. msgtype: link
  57. title: 'search_domain build success'
  58. text: 'please download from aliyun oss. [git.yoqi.me]'
  59. msg_url: '${{ steps.get_version.outputs.url }}'