forked from raryelcostasouza/pyTranscriber
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (103 loc) · 3.99 KB
/
win-pyinstaller-dev2.yml
File metadata and controls
118 lines (103 loc) · 3.99 KB
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
name: Windows PyInstaller
on:
push:
branches:
- master
- develop
pull_request:
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.8", "3.10", "3.12"] # Paraleliza builds para cada versão do Python
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all tags
- name: Get latest Git tag
id: get_version
run: |
$VERSION = git describe --tags --abbrev=0 2>$null
if (-not $VERSION) {
$VERSION = "v0.1.0" # Default version if no tags are found
}
echo "VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
Write-Host "Resolved version: $VERSION"
shell: pwsh
- name: Setup FFmpeg
uses: federicocarboni/setup-ffmpeg@v3.1
with:
ffmpeg-version: release
architecture: x64
- name: Verify FFmpeg installation
run: |
where ffmpeg
ffmpeg -version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Create and activate virtual environment for Python ${{ matrix.python-version }}
run: |
python -m venv .venv-${{ matrix.python-version }}
.\.venv-${{ matrix.python-version }}\Scripts\Activate
shell: pwsh
- name: Install dependencies for Python ${{ matrix.python-version }}
run: |
.\.venv-${{ matrix.python-version }}\Scripts\Activate
python -m ensurepip --upgrade
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pyinstaller
shell: pwsh
- name: Verify whisper assets directory for Python ${{ matrix.python-version }}
run: |
.\.venv-${{ matrix.python-version }}\Scripts\Activate
$whisperPath = (python -c "import whisper; print(whisper.__file__)").Trim()
$assetsPath = Join-Path (Split-Path $whisperPath) 'assets'
if (Test-Path $assetsPath) {
Write-Host "O diretório 'assets' existe em: $assetsPath"
echo "ASSETS_PATH=$assetsPath" >> $env:GITHUB_ENV
} else {
Write-Host "O diretório 'assets' NÃO existe."
exit 1
}
shell: pwsh
- name: Compile with PyInstaller for Python ${{ matrix.python-version }}
run: |
.\.venv-${{ matrix.python-version }}\Scripts\Activate
$ffmpegPath = (Get-Command ffmpeg).Source
pyinstaller main.py `
--onefile `
--path="$(Get-Location)" `
--add-binary="$ffmpegPath;." `
--add-binary="pytranscriber.sqlite;." `
--add-data="pytranscriber/gui/*.qm;pytranscriber/gui/" `
--add-data="${env:ASSETS_PATH};whisper/assets" `
--clean
shell: pwsh
- name: Rename and zip the .exe bundle with version number
run: |
Set-Location -Path dist
Write-Host "Renaming main.exe to pyTranscriber-$env:VERSION.exe"
Rename-Item -Force main.exe "pyTranscriber-$env:VERSION.exe"
Write-Host "Creating zip archive: pyTranscriber-win-$env:VERSION.zip"
Compress-Archive -Path "pyTranscriber-$env:VERSION.exe" -DestinationPath "pyTranscriber-win-$env:VERSION.zip"
shell: pwsh
- name: Upload built executable for Python ${{ matrix.python-version }}
uses: actions/upload-artifact@v4
with:
name: pyTranscriber-win-${{ env.VERSION }}-py${{ matrix.python-version }}
path: ./dist/pyTranscriber-win-${{ env.VERSION }}.zip
download:
runs-on: windows-latest
needs: build
steps:
- name: Download built executables
uses: actions/download-artifact@v4
with:
path: ./output
- name: List downloaded files
run: dir ./output