2024-10-06 15:24:10 +02:00
|
|
|
name: Build for windows and docker and create a release
|
2024-10-05 20:11:56 +02:00
|
|
|
|
|
|
|
# Controls when the workflow will run
|
2024-10-05 14:48:46 +02:00
|
|
|
on:
|
2024-10-05 20:11:56 +02:00
|
|
|
# Triggers the workflow on push or pull request events but only for the "main" branch
|
2024-10-05 14:48:46 +02:00
|
|
|
push:
|
2024-10-05 15:01:25 +02:00
|
|
|
tags: [ 'v*.*.*' ]
|
2024-10-05 14:48:46 +02:00
|
|
|
pull_request:
|
2024-10-05 20:11:56 +02:00
|
|
|
branches: [ "main" ]
|
|
|
|
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
2024-10-05 15:01:25 +02:00
|
|
|
workflow_dispatch:
|
2024-10-05 14:48:46 +02:00
|
|
|
|
2024-10-06 15:24:10 +02:00
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
2024-10-05 20:11:56 +02:00
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
2024-10-05 14:48:46 +02:00
|
|
|
jobs:
|
2024-10-05 20:11:56 +02:00
|
|
|
# This workflow contains a single job called "build"
|
2024-10-06 15:24:10 +02:00
|
|
|
build-windows:
|
2024-10-05 20:11:56 +02:00
|
|
|
# The type of runner that the job will run on
|
2024-10-05 14:48:46 +02:00
|
|
|
runs-on: windows-latest
|
|
|
|
|
2024-10-05 20:11:56 +02:00
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
2024-10-05 14:48:46 +02:00
|
|
|
steps:
|
2024-10-05 20:11:56 +02:00
|
|
|
- name: Check out repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
repository: christofsteel/syng
|
|
|
|
|
|
|
|
- name: Download and extract latest MPV nightly
|
|
|
|
run: |
|
|
|
|
Invoke-WebRequest -Uri https://nightly.link/mpv-player/mpv/workflows/build/master/mpv-x86_64-windows-msvc.zip -OutFile mpv-x86_64-windows-msvc.zip
|
|
|
|
Expand-Archive -Path mpv-x86_64-windows-msvc.zip -DestinationPath .
|
|
|
|
|
|
|
|
- name: Install 7-Zip
|
|
|
|
run: choco install -y 7zip
|
|
|
|
|
|
|
|
- name: Download and extract FFMPEG 7.1
|
|
|
|
run: |
|
|
|
|
Invoke-WebRequest -Uri https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-7.1-full_build.7z -OutFile ffmpeg-release-full.7z
|
|
|
|
7z x ffmpeg-release-full.7z
|
|
|
|
|
|
|
|
- name: Populate workdir
|
|
|
|
run: |
|
|
|
|
mkdir work
|
|
|
|
Copy-Item -Recurse -Verbose syng work/syng
|
|
|
|
Copy-Item -Verbose requirements-client.txt work/requirements.txt
|
|
|
|
Copy-Item -Verbose resources/icons/syng.ico work/
|
|
|
|
Copy-Item -Verbose mpv.exe work/
|
|
|
|
Copy-Item -Verbose vulkan-1.dll work/
|
|
|
|
Copy-Item -Verbose ffmpeg-7.1-full_build/bin/ffmpeg.exe work/
|
|
|
|
|
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
name: Install Python
|
|
|
|
with:
|
|
|
|
python-version: 3.12
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- name: Bundle Syng
|
|
|
|
run: |
|
|
|
|
pip install -r requirements.txt
|
|
|
|
pyinstaller -n "syng-${{ env.VERSION }}" -F -w -i'.\syng.ico' --add-data='.\syng.ico;.' --add-binary '.\mpv.exe;.' --add-binary '.\vulkan-1.dll;.' --add-binary '.\ffmpeg.exe;.' syng/main.py
|
|
|
|
working-directory: ./work
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: Syng Version ${{ env.VERSION }}
|
|
|
|
path: work/dist/syng-${{ env.VERSION }}.exe
|
2024-10-06 15:24:10 +02:00
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
attestations: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check out repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
repository: christofsteel/syng
|
|
|
|
- name: Log in to the Container registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
2024-10-06 15:57:50 +02:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
2024-10-06 15:24:10 +02:00
|
|
|
- name: Build and push Docker image
|
|
|
|
id: push
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./resources/docker/Dockerfile
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
- name: Generate artifact attestation
|
|
|
|
uses: actions/attest-build-provenance@v1
|
|
|
|
with:
|
|
|
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
|
|
|
subject-digest: ${{ steps.push.outputs.digest }}
|
|
|
|
push-to-registry: true
|
|
|
|
|
|
|
|
|