82 lines
No EOL
2.8 KiB
YAML
82 lines
No EOL
2.8 KiB
YAML
name: Build and Publish Release
|
|
|
|
on:
|
|
push: # Оставил для тестов, потом можно закомментировать
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build-linux:
|
|
name: Build Linux
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: git.borderban.ru/borderban/ci-images/py-builder:latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache pip
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
|
|
|
- name: Install Python dependencies
|
|
run: pip install -r requirements.txt
|
|
|
|
- name: Build Linux executable
|
|
run: pyinstaller --onefile --windowed --name factorio-mod-sync-linux main.py
|
|
|
|
- name: Upload Linux artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: linux-build
|
|
path: dist/factorio-mod-sync-linux
|
|
|
|
build-windows:
|
|
name: Build Windows
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: git.borderban.ru/borderban/ci-images/py-builder:latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Python dependencies (Windows)
|
|
# Устанавливаем зависимости именно во внутренний Python внутри Wine
|
|
run: |
|
|
xvfb-run wine "C:\Program Files\Python311\python.exe" -m pip install -r requirements.txt
|
|
|
|
- name: Build Windows executable
|
|
# Используем xvfb-run и прямой путь к исполняемому файлу
|
|
run: |
|
|
xvfb-run wine "C:\Program Files\Python311\python.exe" -m PyInstaller --onefile --windowed --name factorio-mod-sync-windows main.py
|
|
|
|
- name: Upload Windows artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: windows-build
|
|
path: dist/factorio-mod-sync-windows.exe
|
|
|
|
release-assets:
|
|
name: Upload Assets to Release
|
|
needs: [build-linux, build-windows]
|
|
runs-on: ubuntu-latest
|
|
# Запускается при создании релиза или если ты вручную нажал push (для теста)
|
|
if: github.event_name == 'release' || github.event_name == 'push'
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Add files to Forgejo Release
|
|
# Для Forgejo лучше использовать нативный action или проверь совместимость этого
|
|
uses: https://github.com/softprops/action-gh-release@v2
|
|
with:
|
|
fail_on_unmatched_files: false
|
|
files: |
|
|
artifacts/linux-build/factorio-mod-sync-linux
|
|
artifacts/windows-build/factorio-mod-sync-windows.exe
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |