ci: Add GitHub Actions workflow for build and release #34
Workflow file for this run
This file contains hidden or 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
# .github/workflows/release.yml | |
name: Build & Release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
jobs: | |
release: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# --- [БЛОК 1] Сборка исполняемого файла аналитики --- | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Python dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
pip install ultralytics pyinstaller | |
- name: Install Python dependencies (Windows) | |
if: runner.os == 'Windows' | |
run: pip install ultralytics pyinstaller torch torchvision | |
- name: Build analytics executable | |
run: python -m PyInstaller --onefile python_src/analytics.py --distpath extra/analytics --name analytics | |
# --- [БЛОК 2] Сборка Electron-приложения --- | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: sudo apt-get update && sudo apt-get install -y libfuse2 | |
# ---> ИЗМЕНЁН ЭТОТ БЛОК: РАЗДЕЛЕН НА ДВА <--- | |
- name: Build and release for Linux | |
if: runner.os == 'Linux' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
FUSE_PATH=$(readlink -f /usr/lib/x86_64-linux-gnu/libfuse.so.2) | |
echo "FUSE library found at: $FUSE_PATH" | |
EXTRA_FILES_CONFIG='[{"from": "'"$FUSE_PATH"'", "to": "lib/libfuse.so.2"}]' | |
npm run dist -- --publish always --config.linux.extraFiles="$EXTRA_FILES_CONFIG" | |
- name: Build and release for Windows | |
if: runner.os == 'Windows' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: npm run dist -- --publish always |