Files
SoftwareManager/.github/workflows/dev.yml
T
2025-10-12 01:47:43 +02:00

143 lines
4.4 KiB
YAML

name: Build Executables (Dev)
on:
push:
branches:
- main
workflow_dispatch:
inputs:
version:
description: "Dev release version (e.g., v1.0.0-dev)"
required: true
default: "v1.0.0"
permissions:
contents: write
env:
PYTHON_VERSION: "3.11"
APP_NAME: "SoftwareManager"
jobs:
build:
name: Build ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: SoftwareManager-dev-${{ github.run_number }}-linux
asset_name: SoftwareManager-dev-${{ github.run_number }}-linux
- os: windows-latest
artifact_name: SoftwareManager-dev-${{ github.run_number }}-windows.exe
asset_name: SoftwareManager-dev-${{ github.run_number }}-windows.exe
- os: macos-latest
artifact_name: SoftwareManager-dev-${{ github.run_number }}-macos
asset_name: SoftwareManager-dev-${{ github.run_number }}-macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libxcb-xinerama0 \
libxkbcommon-x11-0 \
libxcb-cursor0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-shape0 \
libxcb-util1
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
run: pyinstaller --onefile --windowed --name ${{ env.APP_NAME }} main.py
- name: Make executable (Unix)
if: runner.os != 'Windows'
run: chmod +x dist/${{ env.APP_NAME }}
- name: Rename artifact
shell: bash
run: |
cd dist
mv ${{ env.APP_NAME }}${{ runner.os == 'Windows' && '.exe' || '' }} ${{ matrix.artifact_name }}
ls -la
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-build
path: dist/${{ matrix.artifact_name }}
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: success()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display downloaded artifacts
run: |
echo "Downloaded artifacts:"
find artifacts -type f
ls -la artifacts/
- name: Generate version
id: version
run: |
MAJOR=1
MINOR=0
PATCH=${{ github.run_number }}
VERSION="v${MAJOR}.${MINOR}.${PATCH}-dev"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Generated version: ${VERSION}"
- name: Prepare release files
run: |
mkdir -p release
cp artifacts/ubuntu-latest-build/SoftwareManager-dev-${{ github.run_number }}-linux release/SoftwareManager-dev-1.0.${{ github.run_number }}-linux
cp artifacts/windows-latest-build/SoftwareManager-dev-${{ github.run_number }}-windows.exe release/SoftwareManager-dev-1.0.${{ github.run_number }}-windows.exe
cp artifacts/macos-latest-build/SoftwareManager-dev-${{ github.run_number }}-macos release/SoftwareManager-dev-1.0.${{ github.run_number }}-macos
chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos
ls -la release/
- name: Create Draft Release (Dev)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
draft: true
prerelease: true
files: |
release/SoftwareManager-dev-1.0.${{ github.run_number }}-linux
release/SoftwareManager-dev-1.0.${{ github.run_number }}-windows.exe
release/SoftwareManager-dev-1.0.${{ github.run_number }}-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}