prepare_artifacts.sh 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. if [[ "${SHOULD_BUILD_SRC}" == "yes" ]]; then
  51. git archive --format tar.gz --output="./artifacts/VSCodium-${RELEASE_VERSION}-src.tar.gz" HEAD
  52. git archive --format zip --output="./artifacts/VSCodium-${RELEASE_VERSION}-src.zip" HEAD
  53. fi
  54. VSCODE_PLATFORM="darwin"
  55. elif [[ "${OS_NAME}" == "windows" ]]; then
  56. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  57. yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
  58. if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
  59. yarn gulp "vscode-win32-${VSCODE_ARCH}-archive"
  60. fi
  61. if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
  62. yarn gulp "vscode-win32-${VSCODE_ARCH}-system-setup"
  63. fi
  64. if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
  65. yarn gulp "vscode-win32-${VSCODE_ARCH}-user-setup"
  66. fi
  67. if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
  68. if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
  69. . ../build/windows/msi/build.sh
  70. fi
  71. if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
  72. . ../build/windows/msi/build-updates-disabled.sh
  73. fi
  74. fi
  75. cd ..
  76. if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
  77. echo "Moving ZIP"
  78. mv "vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip" "artifacts\\VSCodium-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip"
  79. fi
  80. if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
  81. echo "Moving System EXE"
  82. mv "vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe" "artifacts\\VSCodiumSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe"
  83. fi
  84. if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
  85. echo "Moving User EXE"
  86. mv "vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe" "artifacts\\VSCodiumUserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe"
  87. fi
  88. if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
  89. if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
  90. echo "Moving MSI"
  91. mv "build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-${RELEASE_VERSION}.msi" artifacts/
  92. fi
  93. if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
  94. echo "Moving MSI with disabled updates"
  95. mv "build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-updates-disabled-${RELEASE_VERSION}.msi" artifacts/
  96. fi
  97. fi
  98. VSCODE_PLATFORM="win32"
  99. else
  100. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  101. if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
  102. yarn gulp "vscode-linux-${VSCODE_ARCH}-build-deb"
  103. fi
  104. if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
  105. yarn gulp "vscode-linux-${VSCODE_ARCH}-build-rpm"
  106. fi
  107. if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
  108. . ../build/linux/appimage/build.sh
  109. fi
  110. cd ..
  111. if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then
  112. echo "Building and moving TAR"
  113. cd "VSCode-linux-${VSCODE_ARCH}"
  114. tar czf "../artifacts/VSCodium-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
  115. cd ..
  116. fi
  117. if [[ "${SHOULD_BUILD_DEB}" != "no" ]]; then
  118. echo "Moving DEB"
  119. mv vscode/.build/linux/deb/*/deb/*.deb artifacts/
  120. fi
  121. if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
  122. echo "Moving RPM"
  123. mv vscode/.build/linux/rpm/*/*.rpm artifacts/
  124. fi
  125. if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
  126. echo "Moving AppImage"
  127. mv build/linux/appimage/out/*.AppImage* artifacts/
  128. find artifacts -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \;
  129. fi
  130. VSCODE_PLATFORM="linux"
  131. fi
  132. if [[ "${SHOULD_BUILD_REH}" != "no" ]]; then
  133. echo "Building and moving REH"
  134. cd "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
  135. tar czf "../artifacts/vscodium-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
  136. cd ..
  137. fi
  138. cd artifacts
  139. for FILE in *
  140. do
  141. if [[ -f "${FILE}" ]]; then
  142. sum_file "${FILE}"
  143. fi
  144. done
  145. cd ..