Skip to content

Commit

Permalink
gh: Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
1299172402 committed Jul 25, 2023
1 parent f4f1098 commit 4744819
Showing 1 changed file with 19 additions and 30 deletions.
49 changes: 19 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ on:
type: boolean
default: false
required: false
buildOnly:
description: 'Only build GUI'
type: boolean
default: true
required: false

jobs:
build:
Expand Down Expand Up @@ -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
Expand All @@ -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*" }
Expand All @@ -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
Expand All @@ -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*" }
Expand All @@ -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/[email protected]
with:
name: BBDown_GUI
path: dist
- name: Upload a Build Artifact (Single File)
uses: actions/[email protected]
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/[email protected]
with:
files: |
dist/BBDown_GUI.exe
dist
LICENSE
BBDown_GUI_Full.zip
draft: true
generate_release_notes: true

0 comments on commit 4744819

Please sign in to comment.