move to ubuntu 20.04 #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux PyInstaller | |
on: | |
push: | |
branches: | |
- main | |
- dev-2.0 | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all tags | |
- name: Get latest Git tag | |
id: get_version | |
run: | | |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0") | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "Resolved version: $VERSION" | |
- name: Setup FFmpeg | |
uses: federicocarboni/setup-ffmpeg@v3.1 | |
with: | |
ffmpeg-version: release | |
architecture: x64 | |
- name: Verify FFmpeg installation | |
run: | | |
which ffmpeg | |
ffmpeg -version | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Set up Python virtual environment | |
run: | | |
python -m venv .venv | |
- name: Activate virtual environment and install dependencies | |
run: | | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
- name: Verify existence of Whisper assets directory | |
run: | | |
source .venv/bin/activate # Activate the virtual environment | |
ASSETS_PATH=$(python -c "import whisper; import os; print(os.path.join(os.path.dirname(whisper.__file__), 'assets'))") | |
if [ -d "$ASSETS_PATH" ]; then | |
echo "The 'assets' directory exists at: $ASSETS_PATH" | |
echo "ASSETS_PATH=$ASSETS_PATH" >> $GITHUB_ENV | |
else | |
echo "The 'assets' directory does NOT exist." | |
exit 1 | |
fi | |
- name: Compile with pyInstaller | |
run: | | |
source .venv/bin/activate | |
FFMPPEG_PATH=$(which ffmpeg) | |
pyinstaller main.py \ | |
--path="$(pwd)" \ | |
--onefile \ | |
--add-binary="$FFMPPEG_PATH:." \ | |
--add-binary="pytranscriber.sqlite:." \ | |
--add-data="pytranscriber/gui/*.qm:pytranscriber/gui/" \ | |
--add-data="$ASSETS_PATH:whisper/assets" | |
- name: Zip the binary with version number | |
run: | | |
cd dist | |
mv main "pyTranscriber-${VERSION}" | |
zip -r "pyTranscriber-${VERSION}.zip" "pyTranscriber-${VERSION}" | |
- name: Upload built executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pyTranscriber-${{ env.VERSION }} | |
path: ./dist/pyTranscriber-${{ env.VERSION }}.zip # Caminho ajustado para Linux | |
download: | |
runs-on: ubuntu-22.04 | |
needs: build | |
steps: | |
- name: Download built executable | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./output | |
- name: List downloaded files | |
run: ls -la ./output |