From 22885fe1586e5da7ce5f5e06cdb030be4ce7f75a Mon Sep 17 00:00:00 2001
From: mfkl <me@martinfinkel.com>
Date: Wed, 20 Oct 2021 17:32:05 +0700
Subject: [PATCH] Add UWP NuGet packaging

---
 .github/workflows/ci.yml | 69 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b0c8eb6..3a905a6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -3,6 +3,8 @@ name: CI
 on:
   push:
   pull_request:
+  schedule:
+    - cron:  '30 5,17 * * *'
 
 jobs:
   LibVLC_iOS_NuGet:
@@ -87,4 +89,69 @@ jobs:
         uses: actions/upload-artifact@v2
         with:
           name: libvlc-uwp-access-build-${{ matrix.arch }}
-          path: vlc-winrt/modules/libaccess_winrt_plugin.UWP/Release/libaccess_winrt_plugin.UWP
\ No newline at end of file
+          path: vlc-winrt/modules/libaccess_winrt_plugin.UWP/Release/libaccess_winrt_plugin.UWP
+  
+  UWP_NuGet:
+    if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
+    runs-on: ubuntu-latest
+    needs: UWP_access_v3
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/download-artifact@v2
+      - name: Download NuGet
+        shell: bash
+        run: |
+          wget https://dist.nuget.org/win-x86-commandline/v5.11.0/nuget.exe
+      - name: Create NuGet folders
+        shell: bash
+        run: |
+          mkdir -p build/win10-arm/native
+          mkdir -p build/win10-x64/native
+          mkdir -p build/win10-x86/native
+      - name: Download and extract UWP builds
+        env:
+            VLC_VERSION: 3.0.16
+        shell: bash
+        run: |
+          wget -O arm.zip https://code.videolan.org/videolan/libvlc-nuget/-/jobs/artifacts/master/download?job=uwp-arm
+          wget -O x86.zip https://code.videolan.org/videolan/libvlc-nuget/-/jobs/artifacts/master/download?job=uwp-x86
+          wget -O x64.zip https://code.videolan.org/videolan/libvlc-nuget/-/jobs/artifacts/master/download?job=uwp-x64
+
+          7z x arm.zip -oarm -y
+          7z x arm/vlc/winarm-uwp/vlc-$VLC_VERSION-win32.7z -oarm/vlc/winarm-uwp -y
+
+          7z x x86.zip -ox86 -y
+          7z x x86/vlc/win32-uwp/vlc-$VLC_VERSION-win32.7z -ox86/vlc/win32-uwp -y
+
+          7z x x64.zip -ox64 -y
+          7z x x64/vlc/win64-uwp/vlc-$VLC_VERSION-win64.7z -ox64/vlc/win64-uwp -y
+
+          mv arm/vlc/winarm-uwp/vlc-$VLC_VERSION/lua build/win10-arm/native
+          mv arm/vlc/winarm-uwp/vlc-$VLC_VERSION/plugins build/win10-arm/native
+          mv libvlc-uwp-access-build-arm/libaccess_winrt_plugin.dll build/win10-arm/native/plugins/access
+          mv arm/vlc/winarm-uwp/vlc-$VLC_VERSION/sdk build/win10-arm/native
+          mv arm/vlc/winarm-uwp/vlc-$VLC_VERSION/libvlc.dll build/win10-arm/native
+          mv arm/vlc/winarm-uwp/vlc-$VLC_VERSION/libvlccore.dll build/win10-arm/native
+
+          mv x86/vlc/win32-uwp/vlc-$VLC_VERSION/lua build/win10-x86/native
+          mv x86/vlc/win32-uwp/vlc-$VLC_VERSION/plugins build/win10-x86/native
+          mv libvlc-uwp-access-build-x86/libaccess_winrt_plugin.dll build/win10-x86/native/plugins/access
+          mv x86/vlc/win32-uwp/vlc-$VLC_VERSION/sdk build/win10-x86/native
+          mv x86/vlc/win32-uwp/vlc-$VLC_VERSION/libvlc.dll build/win10-x86/native
+          mv x86/vlc/win32-uwp/vlc-$VLC_VERSION/libvlccore.dll build/win10-x86/native
+
+          mv x64/vlc/win64-uwp/vlc-$VLC_VERSION/lua build/win10-x64/native
+          mv x64/vlc/win64-uwp/vlc-$VLC_VERSION/plugins build/win10-x64/native
+          mv libvlc-uwp-access-build-x64/libaccess_winrt_plugin.dll build/win10-x64/native/plugins/access
+          mv x64/vlc/win64-uwp/vlc-$VLC_VERSION/sdk build/win10-x64/native
+          mv x64/vlc/win64-uwp/vlc-$VLC_VERSION/libvlc.dll build/win10-x64/native
+          mv x64/vlc/win64-uwp/vlc-$VLC_VERSION/libvlccore.dll build/win10-x64/native
+      - name: Package NuGet
+        shell: bash
+        run: |
+          mono nuget.exe pack VideoLAN.LibVLC.UWP.nuspec
+      - name: Upload NuGet package
+        uses: actions/upload-artifact@v2
+        with:
+          name: libvlc-uwp
+          path: '*.nupkg'
-- 
GitLab