-
Notifications
You must be signed in to change notification settings - Fork 28
194 lines (166 loc) · 7.89 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Pack Python application
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
workflow_dispatch:
inputs:
doRelease:
description: 'Publish new release'
type: boolean
default: false
required: false
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: mkdir dist
run: |
mkdir dist > $null
- name: Update BBDown_GUI version
run: |
$version = ""
if ( $${{ github.event.inputs.doRelease == 'true' }} ) {
$version = "$(git describe --tags --abbrev=0)"
} else {
$version = "$(git describe --tags --always)"
}
Write-Host BBDown_GUI-Version: $version
Add-Content -Path $env:GITHUB_ENV -Value "bbdown_gui_version=$version"
# Replace BBDown_GUI version in ui_about.py
$filePath = "./BBDown_GUI/UI/ui_about.py"
(Get-Content $filePath) | Foreach-Object {$_ -replace '\$bbdown-gui-version\$', "$version"} | Set-Content $filePath
- name: Update FFmpeg version
run: |
# Get latest ffmpeg version and website
$url = "https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/latest"
$response = Invoke-WebRequest -Uri $url | ConvertFrom-Json
$version = $response.name
$tag = $version
$tag = $tag.Replace("Latest Auto-Build (", "autobuild-")
$tag = $tag.Replace(" ", "-")
$tag = $tag.Replace(":", "-")
$tag = $tag.Replace(")", "")
$website = "https://github.com/BtbN/FFmpeg-Builds/releases/tag/$tag"
Write-Host FFmpeg-Version: $version
Write-Host FFmpeg-Version-Website: $website
Add-Content -Path $env:GITHUB_ENV -Value "ffmpeg_version=$version"
# Replace ffmpeg version in ui_about.py
$filePath = "./BBDown_GUI/UI/ui_about.py"
(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
# 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
run: |
# Get latest BBDown version and website
$url = "https://api.github.com/repos/nilaoda/BBDown/releases/latest"
$response = Invoke-WebRequest -Uri $url | ConvertFrom-Json
$version = $response.name
$website = $response.html_url
Write-Host BBDown-Version: $version
Write-Host BBDown-Version-Website: $website
Add-Content -Path $env:GITHUB_ENV -Value "bbdown_version=$version"
# Replace BBDown version in ui_about.py
$filePath = "./BBDown_GUI/UI/ui_about.py"
(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
# 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*" }
$browser_download_url = $asset.browser_download_url
Write-Host BBDown-Download-Url: $browser_download_url
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
run: |
# Get latest aria2 version and website
$url = "https://api.github.com/repos/aria2/aria2/releases/latest"
$response = Invoke-WebRequest -Uri $url | ConvertFrom-Json
$version = $response.name
$website = $response.html_url
Write-Host Aria2-Version: $version
Write-Host Aria2-Version-Website: $website
Add-Content -Path $env:GITHUB_ENV -Value "aria2_version=$version"
# Replace aria2 version in ui_about.py
$filePath = "./BBDown_GUI/UI/ui_about.py"
(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
# 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*" }
$browser_download_url = $asset.browser_download_url
Write-Host Aria2-Download-Url: $browser_download_url
Invoke-WebRequest -Uri $browser_download_url -OutFile temp/aria2-win-64bit.zip
Expand-Archive -Path temp/aria2-win-64bit.zip -DestinationPath ./temp
mv temp/aria2-*/aria2c.exe dist/aria2c.exe
Remove-Item -Recurse -Force ./temp
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
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"
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/BBDown_GUI.exe
- name: Compress the Full
if: ${{ github.event.inputs.doRelease == 'true' }}
run: |
Write-Host "BBDown_GUI-Version: ${{ env.bbdown_gui_version }}"
Write-Host "BBDown-Version: ${{ env.bbdown_version }}"
Write-Host "FFmpeg-Version: ${{ env.ffmpeg_version }}"
Write-Host "Aria2-Version: ${{ env.aria2_version }}"
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
BBDown_GUI_Full.zip
draft: true
generate_release_notes: true
body: |
蓝奏云:https://zhiyuyu.lanzout.com/b09axrdjc 密码:down
### 适配 ${{ env.bbdown_version }} 及之后版本
### 适配 BBDown
- 下载地址引入双引号 #10 https://github.com/nilaoda/BBDown/issues/444 e48763e4c34931a666af81aeed8a4d2caa6aa8ce
- 跳过AI字幕选项 开启和关闭 #11 411dffc59f5b7dc7b16eb8c51078c7c40571d394
### 添加功能
- 完全隐去了命令行界面,输出在可视化窗口中 00715255a1d857f3195e91ce9ee2a7f960e4808e
- 引入了停止下载的功能 a993b061c3a9b20ceae0191412240f36b555f66a
### 本次更新后蓝奏云包含的各软件版本
- BBDown - GUI ${{ env.bbdown_gui_version }}
- ${{ env.bbdown_version }}
- FFmpeg ${{ env.ffmpeg_version }}
- ${{ env.aria2_version }}