prepare_artifacts.sh 5.3 KB

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