Skip to content

Build Whisper Transcription Tool #4

Build Whisper Transcription Tool

Build Whisper Transcription Tool #4

Workflow file for this run

name: Build Whisper Transcription Tool
on:
push:
tags: ['v*'] # Trigger on version tags
workflow_dispatch: # Manual trigger
env:
# ===== CORE CONFIGURATION =====
APP_NAME: "SoundTranscriber"
PYTHON_VERSION: "3.11.9"
BUILD_ROOT: "exe_build" # Root directory for build resources
# MAIN_SCRIPT will be defined in jobs context
# ===== BUILD CONFIGURATION =====
# OUTPUT_EXE will be defined in jobs context
# ICON_FILE will be defined in jobs context
# ADDITIONAL_FILES will be defined in jobs context
CONSOLE_APP: "false" # Set to "true" for console apps
# ===== DEPENDENCY CONFIGURATION =====
USE_CHOCO_FFMPEG: "true"
WHISPER_MODEL: "small" # tiny, base, small, medium, large
jobs:
build-windows-exe:
name: Build Windows EXE
runs-on: windows-latest
env:
# Define these here where we can reference the global env vars
MAIN_SCRIPT: "./exe_build/main.py"
OUTPUT_EXE: "Transcribe.exe"
ICON_FILE: "./exe_build/app.ico"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Verify build directory structure
run: |
if (-not (Test-Path "./exe_build")) {
Write-Error "Build root directory './exe_build' not found!"
exit 1
}
if (-not (Test-Path "./exe_build/main.py")) {
Write-Error "Main script './exe_build/main.py' not found!"
exit 1
}
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "3.11.9"
- name: Install Chocolatey (if needed)
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- name: Install FFmpeg via Chocolatey
run: choco install ffmpeg -y --no-progress
- name: Install Python dependencies
working-directory: "./exe_build"
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install git+https://github.com/openai/whisper.git
if (Test-Path "requirements.txt") {
pip install -r requirements.txt
}
- name: Generate PyInstaller command
id: pyinstaller
run: |
$command = "pyinstaller --noconfirm --clean --onefile"
$command += " --name Transcribe"
$command += " --distpath ../dist"
$command += " --workpath ../build"
$command += " --specpath ../build"
$command += " --windowed"
if ("${{ env.ICON_FILE }}" -ne "" -and (Test-Path "${{ env.ICON_FILE }}")) {
$command += " --icon ${{ env.ICON_FILE }}"
}
$command += " ${{ env.MAIN_SCRIPT }}"
echo "command=$command" >> $env:GITHUB_OUTPUT
- name: Run PyInstaller
working-directory: "./exe_build"
run: ${{ steps.pyinstaller.outputs.command }}
- name: Create release package
run: |
$version = git describe --tags --abbrev=0
$zipName = "Transcript_${version}.zip"
$sourceFiles = @(
"dist/Transcript.exe"
)
Compress-Archive -Path $sourceFiles -DestinationPath "dist/$zipName" -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Transcript_Build
path: dist/Transcript_*.zip
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: dist/Transcript_*.zip
generate_release_notes: true