syng/.github/workflows/windows.yaml

118 lines
4.6 KiB
YAML
Raw Normal View History

2025-02-15 16:48:05 +01:00
name: Build for windows
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-windows:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
repository: christofsteel/syng
- name: Install 7-Zip
run: choco install -y 7zip
- name: Download and extract latest MPV nightly
run: |
Invoke-WebRequest -Uri https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/20250215/mpv-dev-x86_64-20250215-git-834f99e.7z -OutFile mpv.7z
7z x mpv.7z
- name: Download and extract FFMPEG 7.1
run: |
Invoke-WebRequest -Uri https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z -OutFile ffmpeg-release-full.7z
7z x ffmpeg-release-full.7z
- name: Populate workdir
run: |
mkdir work
2025-02-15 17:32:09 +01:00
mkdir work/portable
2025-02-15 16:48:05 +01:00
Copy-Item -Verbose requirements-client.txt work/requirements.txt
2025-02-15 17:32:09 +01:00
Copy-Item -Recurse -Verbose syng work/portable/syng
Copy-Item -Verbose resources/icons/syng.ico work/portable/
Copy-Item -Verbose syng/static/background.png work/portable/
Copy-Item -Verbose syng/static/background20perc.png work/portable/
Copy-Item -Verbose libmpv-2.dll work/portable/
Copy-Item -Verbose ffmpeg-7.1-full_build/bin/ffmpeg.exe work/portable/
mkdir work/install
Copy-Item -Recurse -Verbose syng work/install/syng
Copy-Item -Verbose requirements-client.txt work/install/requirements.txt
Copy-Item -Verbose resources/icons/syng.ico work/install/
Copy-Item -Verbose syng/static/background.png work/install/
Copy-Item -Verbose syng/static/background20perc.png work/install/
Copy-Item -Verbose libmpv-2.dll work/install/
Copy-Item -Verbose ffmpeg-7.1-full_build/bin/ffmpeg.exe work/install/
2025-02-15 16:48:05 +01:00
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.13
- name: Install poetry
run: pip install poetry
- name: Extract version from Poetry
id: get_version
run: echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
shell: bash
- name: Install PyInstaller
run: pip install pyinstaller
2025-02-15 17:32:09 +01:00
- name: Installing requirements
run: pip install -r requirements.txt
working-directory: ./work
# - name: Bundle Syng (portable)
# run:
# pyinstaller -n "syng-${{ env.VERSION }}" -F -w -i'.\syng.ico' --add-data='.\syng.ico;.' --add-data='.\background.png;.' --add-data='.\background20perc.png;.' --add-binary '.\libmpv-2.dll;.' --add-binary '.\ffmpeg.exe;.' syng/main.py
# working-directory: ./work/portable
2025-02-15 17:32:09 +01:00
- name: Bundle Syng (install)
run:
2025-02-15 19:48:16 +01:00
pyinstaller -D --contents-directory data -w -i'.\syng.ico' --add-data='.\syng.ico;.' --add-data='.\background.png;.' --add-data='.\background20perc.png;.' --add-binary '.\libmpv-2.dll;.' --add-binary '.\ffmpeg.exe;.' -n syng syng/main.py
2025-02-15 17:32:09 +01:00
working-directory: ./work/install
2025-02-15 19:48:16 +01:00
# build msi
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Install WiX
2025-02-16 00:25:19 +01:00
run: |
dotnet tool install --global wix
wix extension add WixToolset.UI.wixext
2025-02-15 20:38:28 +01:00
- name: Copy wix file to dist
run:
Copy-Item -Verbose resources/windows/syng.wxs work/install/dist/syng.wxs
Copy-Item -Verbose resources/windows/agpl-3.0.rtf work/install/dist/agpl-3.0.rtf
2025-02-15 19:48:16 +01:00
- name: Build WiX on Windows
2025-02-16 00:14:20 +01:00
run: wix build -ext WixToolset.UI.wixext .\syng.wxs
2025-02-15 20:38:28 +01:00
working-directory: ./work/install/dist
2025-02-15 19:48:16 +01:00
2025-02-15 17:32:09 +01:00
# - name: Upload artifact (portable)
# uses: actions/upload-artifact@v4
# with:
# name: Syng Version ${{ env.VERSION }} portable
# path: work/portable/dist/syng-${{ env.VERSION }}.exe
2025-02-15 17:32:09 +01:00
- name: Upload artifact (install)
2025-02-15 16:48:05 +01:00
uses: actions/upload-artifact@v4
with:
2025-02-15 19:48:16 +01:00
name: Syng Version ${{ env.VERSION }} Installer
2025-02-15 21:37:08 +01:00
path: work/install/dist/syng.msi