upload.ps1 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # SPDX-FileCopyrightText: 2019 yuzu Emulator Project
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. param($BUILD_NAME)
  4. $GITDATE = $(git show -s --date=short --format='%ad') -replace "-", ""
  5. $GITREV = $(git show -s --format='%h')
  6. if ("$BUILD_NAME" -eq "mainline") {
  7. $RELEASE_DIST = "yuzu-windows-msvc"
  8. }
  9. else {
  10. $RELEASE_DIST = "yuzu-windows-msvc-$BUILD_NAME"
  11. }
  12. $MSVC_BUILD_ZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.zip" -replace " ", ""
  13. $MSVC_BUILD_PDB = "yuzu-windows-msvc-$GITDATE-$GITREV-debugsymbols.zip" -replace " ", ""
  14. $MSVC_SEVENZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.7z" -replace " ", ""
  15. $MSVC_TAR = "yuzu-windows-msvc-$GITDATE-$GITREV.tar" -replace " ", ""
  16. $MSVC_TARXZ = "yuzu-windows-msvc-$GITDATE-$GITREV.tar.xz" -replace " ", ""
  17. $MSVC_SOURCE = "yuzu-windows-msvc-source-$GITDATE-$GITREV" -replace " ", ""
  18. $MSVC_SOURCE_TAR = "$MSVC_SOURCE.tar"
  19. $MSVC_SOURCE_TARXZ = "$MSVC_SOURCE_TAR.xz"
  20. $env:BUILD_ZIP = $MSVC_BUILD_ZIP
  21. $env:BUILD_SYMBOLS = $MSVC_BUILD_PDB
  22. $env:BUILD_UPDATE = $MSVC_SEVENZIP
  23. $BUILD_DIR = ".\build\bin\Release"
  24. # Cleanup unneeded data in submodules
  25. git submodule foreach git clean -fxd
  26. # Upload debugging symbols
  27. mkdir pdb
  28. Get-ChildItem "$BUILD_DIR\" -Recurse -Filter "*.pdb" | Copy-Item -destination .\pdb
  29. 7z a -tzip $MSVC_BUILD_PDB .\pdb\*.pdb
  30. rm "$BUILD_DIR\*.pdb"
  31. # Create artifact directories
  32. mkdir $RELEASE_DIST
  33. mkdir $MSVC_SOURCE
  34. mkdir "artifacts"
  35. # Build a tar.xz for the source of the release
  36. Copy-Item .\LICENSE.txt -Destination $MSVC_SOURCE
  37. Copy-Item .\README.md -Destination $MSVC_SOURCE
  38. Copy-Item .\CMakeLists.txt -Destination $MSVC_SOURCE
  39. Copy-Item .\src -Recurse -Destination $MSVC_SOURCE
  40. Copy-Item .\externals -Recurse -Destination $MSVC_SOURCE
  41. Copy-Item .\dist -Recurse -Destination $MSVC_SOURCE
  42. Copy-Item .\CMakeModules -Recurse -Destination $MSVC_SOURCE
  43. 7z a -r -ttar $MSVC_SOURCE_TAR $MSVC_SOURCE
  44. 7z a -r -txz $MSVC_SOURCE_TARXZ $MSVC_SOURCE_TAR
  45. # Following section is quick hack to package artifacts differently for GitHub Actions
  46. if ("$env:GITHUB_ACTIONS" -eq "true") {
  47. echo "Hello GitHub Actions"
  48. # With vcpkg we now have a few more dll files
  49. ls .\build\bin\*.dll
  50. cp .\build\bin\*.dll .\artifacts\
  51. # Hopefully there is an exe in either .\build\bin or .\build\bin\Release
  52. cp .\build\bin\yuzu*.exe .\artifacts\
  53. Copy-Item "$BUILD_DIR\*" -Destination "artifacts" -Recurse
  54. Remove-Item .\artifacts\tests.exe -ErrorAction ignore
  55. # None of the other GHA builds are including source, so commenting out today
  56. #Copy-Item $MSVC_SOURCE_TARXZ -Destination "artifacts"
  57. # Are debug symbols important?
  58. # cp .\build\bin\yuzu*.pdb .\pdb\
  59. # Write out a tag BUILD_TAG to environment for the Upload step
  60. # We're getting ${{ github.event.number }} as $env:PR_NUMBER"
  61. echo "env:PR_NUMBER: $env:PR_NUMBER"
  62. if (Test-Path env:PR_NUMBER) {
  63. $PR_NUMBER = $env:PR_NUMBER.Substring(2) -as [int]
  64. $PR_NUMBER_TAG = "pr"+([string]$PR_NUMBER).PadLeft(5,'0')
  65. if ($PR_NUMBER -gt 1){
  66. $BUILD_TAG="verify-$PR_NUMBER_TAG-$GITDATE-$GITREV"
  67. } else {
  68. $BUILD_TAG = "verify-$GITDATE-$GITREV"
  69. }
  70. } else {
  71. # If env:PR_NUMBER isn't set, we should still write out a variable
  72. $BUILD_TAG = "verify-$GITDATE-$GITREV"
  73. }
  74. echo "BUILD_TAG=$BUILD_TAG"
  75. echo "BUILD_TAG=$BUILD_TAG" >> $env:GITHUB_ENV
  76. # For extra job, just the exe
  77. $INDIVIDUAL_EXE = "yuzu-msvc-$BUILD_TAG.exe"
  78. echo "INDIVIDUAL_EXE=$INDIVIDUAL_EXE"
  79. echo "INDIVIDUAL_EXE=$INDIVIDUAL_EXE" >> $env:GITHUB_ENV
  80. echo "Just the exe: $INDIVIDUAL_EXE"
  81. cp .\artifacts\yuzu.exe .\$INDIVIDUAL_EXE
  82. } else {
  83. # Build the final release artifacts
  84. Copy-Item $MSVC_SOURCE_TARXZ -Destination $RELEASE_DIST
  85. Copy-Item "$BUILD_DIR\*" -Destination $RELEASE_DIST -Recurse
  86. rm "$RELEASE_DIST\*.exe"
  87. Get-ChildItem "$BUILD_DIR" -Recurse -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  88. Get-ChildItem "$BUILD_DIR" -Recurse -Filter "QtWebEngineProcess*.exe" | Copy-Item -destination $RELEASE_DIST
  89. 7z a -tzip $MSVC_BUILD_ZIP $RELEASE_DIST\*
  90. 7z a $MSVC_SEVENZIP $RELEASE_DIST
  91. 7z a -r -ttar $MSVC_TAR $RELEASE_DIST
  92. 7z a -r -txz $MSVC_TARXZ $MSVC_TAR
  93. Get-ChildItem . -Filter "*.zip" | Copy-Item -destination "artifacts"
  94. Get-ChildItem . -Filter "*.7z" | Copy-Item -destination "artifacts"
  95. Get-ChildItem . -Filter "*.tar.xz" | Copy-Item -destination "artifacts"
  96. }