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