From 2899cac40c7b9df8b793a1f3fa36ebc69e265a40 Mon Sep 17 00:00:00 2001 From: lerdb Date: Wed, 31 Jan 2024 00:12:19 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E9=87=8D=E5=86=99=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_beta.yml | 55 ++++++++++++++++---------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build_beta.yml b/.github/workflows/build_beta.yml index 8cfc907..b218bd5 100644 --- a/.github/workflows/build_beta.yml +++ b/.github/workflows/build_beta.yml @@ -1,5 +1,3 @@ -# this workflow using github actions to build a binary exe file for windows users - name: build beta on: @@ -9,8 +7,11 @@ on: branches: [main] jobs: - build-windows: - runs-on: windows-latest + build: + strategy: + matrix: + runs-on: [windows-latest, macos-latest, ubuntu-latest] + runs-on: ${{ matrix.runs-on }} steps: - name: Checkout git repo uses: actions/checkout@v2 @@ -26,37 +27,37 @@ jobs: - name: Install dependencies run: python -m pip install -r ./requirements.txt - - name: Build EXE + - name: Build run: python build.py build test - name: Upload - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: windows + name: dist-${{ matrix.runs-on }} path: ./dist - - build-linux: + + post: + needs: build runs-on: ubuntu-latest steps: - name: Checkout git repo uses: actions/checkout@v2 - - - name: Setup Python 3.11 - uses: actions/setup-python@v2 + + - name: Download Build Files + uses: actions/download-artifact@v4 with: - python-version: '3.11' + path: dist + pattern: dist-* + merge-multiple: false - - name: Install pyinstaller - run: python -m pip install pyinstaller - - - name: Install dependencies - run: python -m pip install -r ./requirements.txt - - - name: Build Executable - run: python build.py build test - - - name: Upload - uses: actions/upload-artifact@v2 - with: - name: linux - path: ./dist \ No newline at end of file + - name: Get File Address + run: | + echo "windowsFile=./dist/dist-windows-latest/lx-music-api-server_$(git rev-parse --short HEAD).exe" >> $GITHUB_ENV + echo "macosFile=./dist/dist-macos-latest/lx-music-api-server_$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "linuxFile=./dist/dist-ubuntu-latest/lx-music-api-server_$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Post to Channel + run: | + echo ${{ secrets.SCRIPT_BASE64 }} | base64 -d > test.py + ESCAPED=`python test.py` + curl -s -v "https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMediaGroup?chat_id=${{ secrets.TELEGRAM_ID }}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://windows%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F windows=@${{ env.windowsFile }} \ No newline at end of file