prepare_artifacts.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. #!/bin/bash
  2. set -e
  3. npm install -g checksum
  4. sum_file() {
  5. if [[ -f "${1}" ]]; then
  6. echo "Calcuating checksum for ${1}"
  7. checksum -a sha256 "${1}" > "${1}".sha256
  8. checksum "${1}" > "${1}".sha1
  9. fi
  10. }
  11. mkdir -p artifacts
  12. if [[ "${OS_NAME}" == "osx" ]]; then
  13. if [[ "${CI_BUILD}" != "no" ]]; then
  14. cd "VSCode-darwin-${VSCODE_ARCH}"
  15. CERTIFICATE_P12=VSCodium.p12
  16. KEYCHAIN="${RUNNER_TEMP}/build.keychain"
  17. echo "${CERTIFICATE_OSX_P12}" | base64 --decode > "${CERTIFICATE_P12}"
  18. security create-keychain -p mysecretpassword "${KEYCHAIN}"
  19. security default-keychain -s "${KEYCHAIN}"
  20. security unlock-keychain -p mysecretpassword "${KEYCHAIN}"
  21. security import "${CERTIFICATE_P12}" -k "${KEYCHAIN}" -P "${CERTIFICATE_OSX_PASSWORD}" -T /usr/bin/codesign
  22. security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword "${KEYCHAIN}"
  23. if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
  24. codesign --deep --force --verbose --sign "${CERTIFICATE_OSX_ID}" "VSCodium - Insiders.app"
  25. else
  26. codesign --deep --force --verbose --sign "${CERTIFICATE_OSX_ID}" "VSCodium.app"
  27. fi
  28. cd ..
  29. fi
  30. if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
  31. echo "Building and moving ZIP"
  32. cd "VSCode-darwin-${VSCODE_ARCH}"
  33. zip -r -X -y "../artifacts/VSCodium-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ./*.app
  34. cd ..
  35. fi
  36. if [[ "${SHOULD_BUILD_DMG}" != "no" ]]; then
  37. echo "Building and moving DMG"
  38. pushd "VSCode-darwin-${VSCODE_ARCH}"
  39. npx create-dmg ./*.app ..
  40. mv ../*.dmg "../artifacts/VSCodium.${VSCODE_ARCH}.${RELEASE_VERSION}.dmg"
  41. popd
  42. fi
  43. VSCODE_PLATFORM="darwin"
  44. elif [[ "${OS_NAME}" == "windows" ]]; then
  45. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  46. yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
  47. if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
  48. yarn gulp "vscode-win32-${VSCODE_ARCH}-archive"
  49. fi
  50. if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
  51. yarn gulp "vscode-win32-${VSCODE_ARCH}-system-setup"
  52. fi
  53. if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
  54. yarn gulp "vscode-win32-${VSCODE_ARCH}-user-setup"
  55. fi
  56. if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
  57. if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
  58. . ../build/windows/msi/build.sh
  59. fi
  60. if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
  61. . ../build/windows/msi/build-updates-disabled.sh
  62. fi
  63. fi
  64. cd ..
  65. if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
  66. echo "Moving ZIP"
  67. mv "vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip" "artifacts\\VSCodium-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip"
  68. fi
  69. if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
  70. echo "Moving System EXE"
  71. mv "vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe" "artifacts\\VSCodiumSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe"
  72. fi
  73. if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
  74. echo "Moving User EXE"
  75. mv "vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe" "artifacts\\VSCodiumUserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe"
  76. fi
  77. if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
  78. if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
  79. echo "Moving MSI"
  80. mv "build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-${RELEASE_VERSION}.msi" artifacts/
  81. fi
  82. if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
  83. echo "Moving MSI with disabled updates"
  84. mv "build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-updates-disabled-${RELEASE_VERSION}.msi" artifacts/
  85. fi
  86. fi
  87. VSCODE_PLATFORM="win32"
  88. else
  89. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  90. if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
  91. yarn gulp "vscode-linux-${VSCODE_ARCH}-build-deb"
  92. fi
  93. if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
  94. yarn gulp "vscode-linux-${VSCODE_ARCH}-build-rpm"
  95. fi
  96. if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
  97. . ../build/linux/appimage/build.sh
  98. fi
  99. cd ..
  100. if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then
  101. echo "Building and moving TAR"
  102. cd "VSCode-linux-${VSCODE_ARCH}"
  103. tar czf "../artifacts/VSCodium-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
  104. cd ..
  105. fi
  106. if [[ "${SHOULD_BUILD_DEB}" != "no" ]]; then
  107. echo "Moving DEB"
  108. mv vscode/.build/linux/deb/*/deb/*.deb artifacts/
  109. fi
  110. if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
  111. echo "Moving RPM"
  112. mv vscode/.build/linux/rpm/*/*.rpm artifacts/
  113. fi
  114. if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
  115. echo "Moving AppImage"
  116. mv build/linux/appimage/out/*.AppImage* artifacts/
  117. find artifacts -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \;
  118. fi
  119. VSCODE_PLATFORM="linux"
  120. fi
  121. if [[ "${SHOULD_BUILD_REH}" != "no" ]]; then
  122. echo "Building and moving REH"
  123. cd "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
  124. tar czf "../artifacts/vscodium-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
  125. cd ..
  126. fi
  127. cd artifacts
  128. for FILE in *
  129. do
  130. if [[ -f "${FILE}" ]]; then
  131. sum_file "${FILE}"
  132. fi
  133. done
  134. cd ..