From 901ab98fbad8eaec5c88f5497e6e1991d15fb0c3 Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Sat, 9 Nov 2024 06:53:58 +0300 Subject: [PATCH] Create build-to-release.yml --- .github/workflows/build-to-release.yml | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/build-to-release.yml diff --git a/.github/workflows/build-to-release.yml b/.github/workflows/build-to-release.yml new file mode 100644 index 0000000..dd8e495 --- /dev/null +++ b/.github/workflows/build-to-release.yml @@ -0,0 +1,64 @@ +name: Build Windows LoaderSpot + +on: + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + strategy: + matrix: + architecture: [x86, x64] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.13' + architecture: ${{ matrix.architecture }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install aiohttp + pip install tqdm + pip install pyinstaller + + - name: Build executable + run: | + pyinstaller --onefile --clean --name LoaderSpot_${{ matrix.architecture }} LoaderSpot.py + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: LoaderSpot_${{ matrix.architecture }} + path: dist/LoaderSpot_${{ matrix.architecture }}.exe + + - name: Get latest release + id: latest_release + uses: actions/github-script@v6 + with: + script: | + const releases = await github.rest.repos.listReleases({ + owner: context.repo.owner, + repo: context.repo.repo + }); + return releases.data[0].id; + result-encoding: string + + - name: Upload to Release + uses: actions/github-script@v6 + with: + script: | + const fs = require('fs'); + const releaseId = ${{ steps.latest_release.outputs.result }}; + + await github.rest.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: releaseId, + name: `LoaderSpot_${{ matrix.architecture }}.exe`, + data: fs.readFileSync(`dist/LoaderSpot_${{ matrix.architecture }}.exe`) + });