eventually fix github actions?

This commit is contained in:
Vxrtrauter
2025-10-12 01:20:26 +02:00
parent a0f772def8
commit 8c787db331
+84 -42
View File
@@ -4,81 +4,123 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: "1.0" description: "Release version (e.g., v1.0.0)"
required: true required: true
default: "v1.0.0"
env:
PYTHON_VERSION: "3.11"
APP_NAME: "app"
jobs: jobs:
build: build:
name: Build ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] include:
- os: ubuntu-latest
artifact_name: app-linux
asset_name: app-linux
- os: windows-latest
artifact_name: app-windows.exe
asset_name: app-windows.exe
- os: macos-latest
artifact_name: app-macos
asset_name: app-macos
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout repository - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies - name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: | run: |
pip install -r requirements.txt sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
libxcb-xinerama0 libxkbcommon-x11-0 libxcb-cursor0 \ libxcb-xinerama0 \
libxcb-keysyms1 libxcb-render-util0 libxcb-icccm4 \ libxkbcommon-x11-0 \
libxcb-image0 libxcb-shape0 libxcb-util1 libxcb-cursor0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-shape0 \
libxcb-util1
- name: Build executable - name: Install Python dependencies
run: pyinstaller --onefile main.py
- name: Rename executable
run: | run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then python -m pip install --upgrade pip
mv dist/app.exe dist/app-windows.exe pip install -r requirements.txt
elif [[ "$RUNNER_OS" == "Linux" ]]; then pip install pyinstaller
mv dist/app dist/app-linux
elif [[ "$RUNNER_OS" == "macOS" ]]; then
mv dist/app dist/app-macos
fi
shell: bash
- name: Upload artifact - name: Build executable with PyInstaller
run: pyinstaller --onefile --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 uses: actions/upload-artifact@v4
with: with:
name: app-${{ matrix.os }} name: ${{ matrix.os }}-build
path: dist/* path: dist/${{ matrix.artifact_name }}
retention-days: 1
release: release:
name: Create Release
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: success()
steps: steps:
- name: Checkout repository - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download all build artifacts - name: Download all artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
merge-multiple: true path: artifacts
- name: List downloaded files (Debugging) - name: Display downloaded artifacts
run: ls -R run: |
echo "Downloaded artifacts:"
find artifacts -type f
ls -la artifacts/
- name: Make files executable (Linux/Mac) - name: Prepare release files
run: chmod +x app-* || true run: |
mkdir -p release
cp artifacts/ubuntu-latest-build/app-linux release/
cp artifacts/windows-latest-build/app-windows.exe release/
cp artifacts/macos-latest-build/app-macos release/
chmod +x release/app-linux release/app-macos
ls -la release/
# - name: Create GitHub Release - name: Create GitHub Release
# uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
# with: with:
# tag_name: ${{ github.event.inputs.version }} tag_name: ${{ github.event.inputs.version }}
# name: Release ${{ github.event.inputs.version }} name: Release ${{ github.event.inputs.version }}
# draft: false draft: false
# prerelease: false prerelease: false
# files: | files: |
# app-linux release/app-linux
# app-windows.exe release/app-windows.exe
# app-macos release/app-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}