2023-07-20 18:25:13 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# shellcheck disable=SC1091
|
2021-10-01 16:47:10 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-10-06 20:15:41 +00:00
|
|
|
APP_NAME_LC=$( echo "${APP_NAME}" | awk '{print tolower($0)}' )
|
|
|
|
|
2021-10-01 16:47:10 +00:00
|
|
|
npm install -g checksum
|
|
|
|
|
|
|
|
sum_file() {
|
2022-06-05 19:30:23 +00:00
|
|
|
if [[ -f "${1}" ]]; then
|
2022-10-26 10:19:21 +00:00
|
|
|
echo "Calculating checksum for ${1}"
|
2022-06-05 19:30:23 +00:00
|
|
|
checksum -a sha256 "${1}" > "${1}".sha256
|
|
|
|
checksum "${1}" > "${1}".sha1
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-10-06 20:15:41 +00:00
|
|
|
mkdir -p assets
|
2021-10-01 16:47:10 +00:00
|
|
|
|
|
|
|
if [[ "${OS_NAME}" == "osx" ]]; then
|
2022-08-29 15:53:29 +00:00
|
|
|
if [[ "${CI_BUILD}" != "no" ]]; then
|
|
|
|
cd "VSCode-darwin-${VSCODE_ARCH}"
|
|
|
|
|
2022-10-06 20:15:41 +00:00
|
|
|
CERTIFICATE_P12="${APP_NAME}.p12"
|
2022-09-12 13:52:26 +00:00
|
|
|
KEYCHAIN="${RUNNER_TEMP}/build.keychain"
|
2022-08-29 15:53:29 +00:00
|
|
|
|
|
|
|
echo "${CERTIFICATE_OSX_P12}" | base64 --decode > "${CERTIFICATE_P12}"
|
2022-09-12 12:21:34 +00:00
|
|
|
|
|
|
|
echo "+ create temporary keychain"
|
2022-09-12 13:52:26 +00:00
|
|
|
security create-keychain -p mysecretpassword "${KEYCHAIN}"
|
|
|
|
security set-keychain-settings -lut 21600 "${KEYCHAIN}"
|
|
|
|
security unlock-keychain -p mysecretpassword "${KEYCHAIN}"
|
2023-07-20 18:25:13 +00:00
|
|
|
security list-keychains -s "$(security list-keychains | xargs)" "${KEYCHAIN}"
|
2022-09-12 13:52:26 +00:00
|
|
|
# security list-keychains -d user
|
|
|
|
# security show-keychain-info ${KEYCHAIN}
|
2022-09-12 10:14:30 +00:00
|
|
|
|
2022-09-12 12:21:34 +00:00
|
|
|
echo "+ import certificate to keychain"
|
2022-09-12 13:52:26 +00:00
|
|
|
security import "${CERTIFICATE_P12}" -k "${KEYCHAIN}" -P "${CERTIFICATE_OSX_PASSWORD}" -T /usr/bin/codesign
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k mysecretpassword "${KEYCHAIN}" > /dev/null
|
|
|
|
# security find-identity "${KEYCHAIN}"
|
2022-09-12 10:14:30 +00:00
|
|
|
|
2022-09-12 12:21:34 +00:00
|
|
|
echo "+ signing"
|
2022-08-29 15:53:29 +00:00
|
|
|
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
|
2022-10-06 20:15:41 +00:00
|
|
|
codesign --deep --force --verbose --sign "${CERTIFICATE_OSX_ID}" "${APP_NAME} - Insiders.app"
|
2022-08-29 15:53:29 +00:00
|
|
|
else
|
2022-10-06 20:15:41 +00:00
|
|
|
codesign --deep --force --verbose --sign "${CERTIFICATE_OSX_ID}" "${APP_NAME}.app"
|
2022-08-29 15:53:29 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2021-10-01 16:47:10 +00:00
|
|
|
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
|
|
|
|
echo "Building and moving ZIP"
|
|
|
|
cd "VSCode-darwin-${VSCODE_ARCH}"
|
2022-10-06 20:15:41 +00:00
|
|
|
zip -r -X -y "../assets/${APP_NAME}-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ./*.app
|
2021-10-01 16:47:10 +00:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_DMG}" != "no" ]]; then
|
|
|
|
echo "Building and moving DMG"
|
|
|
|
pushd "VSCode-darwin-${VSCODE_ARCH}"
|
2022-08-29 19:56:51 +00:00
|
|
|
npx create-dmg ./*.app ..
|
2022-10-06 20:15:41 +00:00
|
|
|
mv ../*.dmg "../assets/${APP_NAME}.${VSCODE_ARCH}.${RELEASE_VERSION}.dmg"
|
2021-10-01 16:47:10 +00:00
|
|
|
popd
|
|
|
|
fi
|
2022-06-08 14:59:06 +00:00
|
|
|
|
2022-09-25 16:07:45 +00:00
|
|
|
if [[ "${SHOULD_BUILD_SRC}" == "yes" ]]; then
|
2022-10-06 20:15:41 +00:00
|
|
|
git archive --format tar.gz --output="./assets/${APP_NAME}-${RELEASE_VERSION}-src.tar.gz" HEAD
|
|
|
|
git archive --format zip --output="./assets/${APP_NAME}-${RELEASE_VERSION}-src.zip" HEAD
|
2022-09-25 16:07:45 +00:00
|
|
|
fi
|
|
|
|
|
2022-06-08 14:59:06 +00:00
|
|
|
VSCODE_PLATFORM="darwin"
|
2021-10-01 16:47:10 +00:00
|
|
|
elif [[ "${OS_NAME}" == "windows" ]]; then
|
2022-08-29 15:53:29 +00:00
|
|
|
cd vscode || { echo "'vscode' dir not found"; exit 1; }
|
|
|
|
|
|
|
|
yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
|
|
|
|
yarn gulp "vscode-win32-${VSCODE_ARCH}-archive"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
|
|
|
|
yarn gulp "vscode-win32-${VSCODE_ARCH}-system-setup"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
|
|
|
|
yarn gulp "vscode-win32-${VSCODE_ARCH}-user-setup"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
|
|
|
|
if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
|
|
|
|
. ../build/windows/msi/build.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
|
|
|
|
. ../build/windows/msi/build-updates-disabled.sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
2021-10-01 16:47:10 +00:00
|
|
|
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
|
|
|
|
echo "Moving ZIP"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv "vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip" "assets\\${APP_NAME}-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip"
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
|
|
|
|
echo "Moving System EXE"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv "vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe" "assets\\${APP_NAME}Setup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe"
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
|
|
|
|
echo "Moving User EXE"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv "vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe" "assets\\${APP_NAME}UserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe"
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
|
|
|
|
if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
|
|
|
|
echo "Moving MSI"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv "build\\windows\\msi\\releasedir\\${APP_NAME}-${VSCODE_ARCH}-${RELEASE_VERSION}.msi" assets/
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
|
|
|
|
echo "Moving MSI with disabled updates"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv "build\\windows\\msi\\releasedir\\${APP_NAME}-${VSCODE_ARCH}-updates-disabled-${RELEASE_VERSION}.msi" assets/
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
2022-06-08 14:59:06 +00:00
|
|
|
|
|
|
|
VSCODE_PLATFORM="win32"
|
2021-10-01 16:47:10 +00:00
|
|
|
else
|
2022-08-29 15:53:29 +00:00
|
|
|
cd vscode || { echo "'vscode' dir not found"; exit 1; }
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
|
|
|
|
yarn gulp "vscode-linux-${VSCODE_ARCH}-build-deb"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
|
|
|
|
yarn gulp "vscode-linux-${VSCODE_ARCH}-build-rpm"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
|
|
|
|
. ../build/linux/appimage/build.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
2021-10-01 16:47:10 +00:00
|
|
|
if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then
|
|
|
|
echo "Building and moving TAR"
|
2022-06-05 19:30:23 +00:00
|
|
|
cd "VSCode-linux-${VSCODE_ARCH}"
|
2022-10-06 20:15:41 +00:00
|
|
|
tar czf "../assets/${APP_NAME}-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
|
2021-10-01 16:47:10 +00:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_DEB}" != "no" ]]; then
|
|
|
|
echo "Moving DEB"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv vscode/.build/linux/deb/*/deb/*.deb assets/
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then
|
|
|
|
echo "Moving RPM"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv vscode/.build/linux/rpm/*/*.rpm assets/
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then
|
|
|
|
echo "Moving AppImage"
|
2022-10-06 20:15:41 +00:00
|
|
|
mv build/linux/appimage/out/*.AppImage* assets/
|
2022-08-29 19:56:51 +00:00
|
|
|
|
2022-10-06 20:15:41 +00:00
|
|
|
find assets -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \;
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
2022-06-08 14:59:06 +00:00
|
|
|
|
|
|
|
VSCODE_PLATFORM="linux"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD_REH}" != "no" ]]; then
|
|
|
|
echo "Building and moving REH"
|
|
|
|
cd "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
|
2022-10-06 20:15:41 +00:00
|
|
|
tar czf "../assets/${APP_NAME_LC}-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
|
2022-06-08 14:59:06 +00:00
|
|
|
cd ..
|
2021-10-01 16:47:10 +00:00
|
|
|
fi
|
|
|
|
|
2022-10-06 20:15:41 +00:00
|
|
|
cd assets
|
2021-10-01 16:47:10 +00:00
|
|
|
|
|
|
|
for FILE in *
|
|
|
|
do
|
|
|
|
if [[ -f "${FILE}" ]]; then
|
|
|
|
sum_file "${FILE}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
cd ..
|