name: Publish Installers on: workflow_dispatch: ~ push: branches: [master] tags: [v*] jobs: build: name: Build ${{ matrix.os }} Package runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-20.04, windows-latest] steps: - name: Checkout Code uses: actions/checkout@v4 - name: Set Release Version id: get_version shell: bash run: | echo "::set-output name=hash::$(git rev-parse --short HEAD)" echo "::set-output name=date::$(date +%Y%m%d)" echo "::set-output name=url::$(git remote get-url origin)" - name: Set Up Python uses: actions/setup-python@v4 with: python-version: '3.9' cache: pip cache-dependency-path: '**/requirements*.txt' - name: Install Dependencies run: | python -m pip install --upgrade pip wheel setuptools pip install -r requirements.txt python -m pip install pyinstaller - name: Build Package run: | python -m PyInstaller fgh.spec python -m PyInstaller fgh-server.spec cp .env ./dist && cp -R scripts/* ./dist - name: Archive linux Package if: ${{ runner.os == 'Linux' }} run: | tar -zcvf fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.tar.gz dist/* find dist/ -type f -delete mv fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.tar.gz dist - name: Archive Windows Package if: ${{ runner.os == 'Windows' }} run: | 7z a -r fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.zip ./dist Remove-Item -Path dist -Recurse -Force mkdir dist && mv fgh-${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}.zip dist - name: Update to ali oss uses: yizhoumo/setup-ossutil@v1 with: endpoint: oss-cn-qingdao.aliyuncs.com access-key-id: ${{ secrets.OSS_KEY_ID }} access-key-secret: ${{ secrets.OSS_KEY_SECRET }} - name: cp files to aliyun run: | ossutil cp -r dist/ oss://yoqi-software/develop/fgh/${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}/ - uses: leafney/dingtalk-action@v1 if: always() env: DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }} with: msgtype: link title: 'fgh build success' text: 'please download from aliyun oss. [git.yoqi.me]' msg_url: '${{ steps.get_version.outputs.url }}'