From 4744819ee2cdc4076217b4e71ec7f146d52ace73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=8B=E9=9B=A8?= <29673994+1299172402@users.noreply.github.com> Date: Tue, 25 Jul 2023 14:58:47 +0800 Subject: [PATCH] gh: Update build.yml --- .github/workflows/build.yml | 49 ++++++++++++++----------------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af0df36..3fe081c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,11 +12,6 @@ on: type: boolean default: false required: false - buildOnly: - description: 'Only build GUI' - type: boolean - default: true - required: false jobs: build: @@ -66,18 +61,13 @@ jobs: (Get-Content $filePath) | Foreach-Object {$_ -replace '\$ffmpeg-version\$', "$version"} | Set-Content $filePath (Get-Content $filePath) | Foreach-Object {$_ -replace '\$ffmpeg-version-url\$', "$website"} | Set-Content $filePath - - name: Download FFmpeg - if: ${{ github.ref == 'refs/heads/main' }} || ${{ github.event.inputs.buildOnly == 'false' }} || ${{ github.event.inputs.doRelease == 'true' }} - run: | - mkdir temp > $null - # Download ffmpeg + mkdir temp > $null $browser_download_url = "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip" Write-Host FFmpeg-Download-Url: $browser_download_url Invoke-WebRequest -Uri $browser_download_url -OutFile temp/ffmpeg-master-latest-win64-gpl.zip Expand-Archive -Path temp/ffmpeg-master-latest-win64-gpl.zip -DestinationPath ./temp mv temp/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe dist/ffmpeg.exe - Remove-Item -Recurse -Force ./temp - name: Update BBDown version @@ -95,12 +85,8 @@ jobs: (Get-Content $filePath) | Foreach-Object {$_ -replace '\$bbdown-version\$', "$version"} | Set-Content $filePath (Get-Content $filePath) | Foreach-Object {$_ -replace '\$bbdown-version-url\$', "$website"} | Set-Content $filePath - - name: Download BBDown - if: ${{ github.ref == 'refs/heads/main' }} || ${{ github.event.inputs.buildOnly == 'false' }} || ${{ github.event.inputs.doRelease == 'true' }} - run: | - mkdir temp > $null - # Download BBDown + mkdir temp > $null $url = "https://api.github.com/repos/nilaoda/BBDown/releases/latest" $response = Invoke-WebRequest -Uri $url | ConvertFrom-Json $asset = $response.assets | Where-Object { $_.name -like "*win-x64*" } @@ -109,7 +95,6 @@ jobs: Invoke-WebRequest -Uri $browser_download_url -OutFile temp/BBDown_win-x64.zip Expand-Archive -Path temp/BBDown_win-x64.zip -DestinationPath ./temp mv temp/BBDown.exe dist/BBDown.exe - Remove-Item -Recurse -Force ./temp - name: Update aria2 version @@ -127,12 +112,8 @@ jobs: (Get-Content $filePath) | Foreach-Object {$_ -replace '\$aria2c-version\$', "$version"} | Set-Content $filePath (Get-Content $filePath) | Foreach-Object {$_ -replace '\$aria2c-version-url\$', "$website"} | Set-Content $filePath - - name: Download aria2 - if: ${{ github.ref == 'refs/heads/main' }} || ${{ github.event.inputs.buildOnly == 'false' }} || ${{ github.event.inputs.doRelease == 'true' }} - run: | - mkdir temp > $null - # Download aria2 + mkdir temp > $null $url = "https://api.github.com/repos/aria2/aria2/releases/latest" $response = Invoke-WebRequest -Uri $url | ConvertFrom-Json $asset = $response.assets | Where-Object { $_.name -like "*win-64bit*" } @@ -150,28 +131,36 @@ jobs: python-version: "3.10" - name: Install dependencies run: | - python -m pip install --upgrade pip pip install -r requirements.txt pip install pyinstaller - name: build py to exe run: | pyinstaller --noconfirm --onefile --noconsole --icon "./BBDown_GUI/UI/favicon.ico" --add-data "./BBDown_GUI/UI/favicon.ico;./UI" "./build-to-exe.py" - - name: Rename build file - run: | - cd dist - mv build-to-exe.exe BBDown_GUI.exe - - name: Upload a Build Artifact + mv ./dist/build-to-exe.exe ./dist/BBDown_GUI.exe + + - name: Upload a Build Artifact (Full) uses: actions/upload-artifact@v3.1.2 with: name: BBDown_GUI path: dist + - name: Upload a Build Artifact (Single File) + uses: actions/upload-artifact@v3.1.2 + with: + name: BBDown_GUI_single_file + path: dist + + - name: Compress the Full + if: ${{ github.event.inputs.doRelease == 'true' }} + run: | + Compress-Archive -Path dist/* -DestinationPath ./BBDown_GUI_Full.zip - name: GH Release if: ${{ github.event.inputs.doRelease == 'true' }} uses: softprops/action-gh-release@v0.1.15 with: files: | dist/BBDown_GUI.exe - dist - LICENSE + BBDown_GUI_Full.zip draft: true + generate_release_notes: true +