From 1f7e2d1cadf160d0d516567b6970cdd876c29c6d Mon Sep 17 00:00:00 2001
From: lat9nq <lat9nq@gmail.com>
Date: Sun, 31 Jul 2022 01:25:40 -0400
Subject: [PATCH 1/2] ci: Graft source when archiving

Instead of including yuzu and all the sources it uses directly, include
only what specifically belongs to yuzu. Submodules can be downloaded
separately later using git since a shallow clone includes minimally all
the repository information needed for it.
---
 .ci/scripts/common/post-upload.sh |  3 ++-
 .ci/scripts/windows/upload.ps1    | 10 +++-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/.ci/scripts/common/post-upload.sh b/.ci/scripts/common/post-upload.sh
index 7f910b2b38..576f1ffaa1 100644
--- a/.ci/scripts/common/post-upload.sh
+++ b/.ci/scripts/common/post-upload.sh
@@ -8,7 +8,8 @@ cp LICENSE.txt "$DIR_NAME"
 cp README.md "$DIR_NAME"
 
 if [[ -z "${NO_SOURCE_PACK}" ]]; then
-  tar -cJvf "${REV_NAME}-source.tar.xz" src externals CMakeLists.txt README.md LICENSE.txt
+  git clone --depth 1 file://$(readlink -e .) ${REV_NAME}-source
+  tar -cJvf "${REV_NAME}-source.tar.xz" ${REV_NAME}-source
   cp -v "${REV_NAME}-source.tar.xz" "$DIR_NAME"
 fi
 
diff --git a/.ci/scripts/windows/upload.ps1 b/.ci/scripts/windows/upload.ps1
index f2368be6f0..d463281ded 100644
--- a/.ci/scripts/windows/upload.ps1
+++ b/.ci/scripts/windows/upload.ps1
@@ -42,14 +42,10 @@ mkdir $RELEASE_DIST
 mkdir $MSVC_SOURCE
 mkdir "artifacts"
 
+$CURRENT_DIR = Convert-Path .
+
 # Build a tar.xz for the source of the release
-Copy-Item .\LICENSE.txt -Destination $MSVC_SOURCE
-Copy-Item .\README.md -Destination $MSVC_SOURCE
-Copy-Item .\CMakeLists.txt -Destination $MSVC_SOURCE
-Copy-Item .\src -Recurse -Destination $MSVC_SOURCE
-Copy-Item .\externals -Recurse -Destination $MSVC_SOURCE
-Copy-Item .\dist -Recurse -Destination $MSVC_SOURCE
-Copy-Item .\CMakeModules -Recurse -Destination $MSVC_SOURCE
+git clone --depth 1 file://$CURRENT_DIR $MSVC_SOURCE
 7z a -r -ttar $MSVC_SOURCE_TAR $MSVC_SOURCE
 7z a -r -txz $MSVC_SOURCE_TARXZ $MSVC_SOURCE_TAR
 

From 050c7608225502662d495357d55327b42b3c7b33 Mon Sep 17 00:00:00 2001
From: lat9nq <lat9nq@gmail.com>
Date: Tue, 9 Aug 2022 00:18:32 -0400
Subject: [PATCH 2/2] post-upload: Upload Linux source to artifacts dir

The source from the Linux build is desireable as it has permissions and
line endings set correctly.
---
 .ci/scripts/common/post-upload.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.ci/scripts/common/post-upload.sh b/.ci/scripts/common/post-upload.sh
index 576f1ffaa1..0930b7a7bd 100644
--- a/.ci/scripts/common/post-upload.sh
+++ b/.ci/scripts/common/post-upload.sh
@@ -11,6 +11,7 @@ if [[ -z "${NO_SOURCE_PACK}" ]]; then
   git clone --depth 1 file://$(readlink -e .) ${REV_NAME}-source
   tar -cJvf "${REV_NAME}-source.tar.xz" ${REV_NAME}-source
   cp -v "${REV_NAME}-source.tar.xz" "$DIR_NAME"
+  cp -v "${REV_NAME}-source.tar.xz" "${ARTIFACTS_DIR}/"
 fi
 
 tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$DIR_NAME"