From 7e281e251146f1a796731159741bb9dcd6ba9204 Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Fri, 3 Apr 2026 18:04:54 +0200 Subject: [PATCH] refactor: split some scripts by os (#2776) --- build/alpine/check_tags.sh | 54 ++++ build/linux/check_tags.sh | 345 ++++++++++++++++++++ build/linux/prepare_assets.sh | 55 ++++ build/osx/check_tags.sh | 40 +++ build/osx/prepare_assets.sh | 84 +++++ build/windows/check_tags.sh | 105 +++++++ build/windows/prepare_assets.sh | 53 ++++ check_tags.sh | 542 +------------------------------- prepare_assets.sh | 189 +---------- 9 files changed, 743 insertions(+), 724 deletions(-) create mode 100644 build/alpine/check_tags.sh create mode 100644 build/linux/check_tags.sh create mode 100644 build/linux/prepare_assets.sh create mode 100644 build/osx/check_tags.sh create mode 100644 build/osx/prepare_assets.sh create mode 100644 build/windows/check_tags.sh create mode 100644 build/windows/prepare_assets.sh diff --git a/build/alpine/check_tags.sh b/build/alpine/check_tags.sh new file mode 100644 index 0000000..0503255 --- /dev/null +++ b/build/alpine/check_tags.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +if [[ "${CHECK_ONLY_REH}" == "yes" ]]; then + if [[ -z $( contains "${APP_NAME_LC}-reh-alpine-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Alpine ${VSCODE_ARCH} because we have no REH archive" + export SHOULD_BUILD="yes" + else + echo "Already have the Alpine REH ${VSCODE_ARCH} archive" + export SHOULD_BUILD_REH="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-reh-web-alpine-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Alpine ${VSCODE_ARCH} because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + echo "Already have the Alpine REH-web ${VSCODE_ARCH} archive" + export SHOULD_BUILD_REH_WEB="no" + fi +else + + # alpine-arm64 + if [[ "${VSCODE_ARCH}" == "arm64" || "${CHECK_ALL}" == "yes" ]]; then + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-alpine-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Alpine arm64 because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-alpine-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Alpine arm64 because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + fi + + # alpine-x64 + if [[ "${VSCODE_ARCH}" == "x64" || "${CHECK_ALL}" == "yes" ]]; then + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-alpine-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Alpine x64 because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-alpine-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Alpine x64 because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + fi +fi diff --git a/build/linux/check_tags.sh b/build/linux/check_tags.sh new file mode 100644 index 0000000..8962ea8 --- /dev/null +++ b/build/linux/check_tags.sh @@ -0,0 +1,345 @@ +#!/usr/bin/env bash + +if [[ "${CHECK_ONLY_REH}" == "yes" ]]; then + + if [[ -z $( contains "${APP_NAME_LC}-reh-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux ${VSCODE_ARCH} because we have no REH archive" + export SHOULD_BUILD="yes" + else + echo "Already have the Linux REH ${VSCODE_ARCH} archive" + export SHOULD_BUILD_REH="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-reh-web-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux ${VSCODE_ARCH} because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + echo "Already have the Linux REH-web ${VSCODE_ARCH} archive" + export SHOULD_BUILD_REH_WEB="no" + fi + +else + + # linux-arm64 + if [[ "${VSCODE_ARCH}" == "arm64" || "${CHECK_ALL}" == "yes" ]]; then + if [[ -z $( contains "arm64.deb" ) ]]; then + echo "Building on Linux arm64 because we have no DEB" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_DEB="no" + fi + + if [[ -z $( contains "aarch64.rpm" ) ]]; then + echo "Building on Linux arm64 because we have no RPM" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_RPM="no" + fi + + if [[ -z $( contains "${APP_NAME}-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm64 because we have no TAR" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_TAR="no" + fi + + if [[ -z $( contains "arm64.snap" ) || "${FORCE_LINUX_SNAP}" == "true" ]]; then + echo "Building on Linux arm64 because we have no SNAP" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_SNAP="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm64 because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm64 because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + export SHOULD_BUILD_APPIMAGE="no" + + if [[ -z $( contains "${APP_NAME_LC}-cli-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm64 because we have no CLI archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_CLI="no" + fi + + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Linux arm64 builds" + fi + fi + + # linux-armhf + if [[ "${VSCODE_ARCH}" == "armhf" || "${CHECK_ALL}" == "yes" ]]; then + if [[ -z $( contains "armhf.deb" ) ]]; then + echo "Building on Linux arm because we have no DEB" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_DEB="no" + fi + + if [[ -z $( contains "armv7hl.rpm" ) ]]; then + echo "Building on Linux arm because we have no RPM" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_RPM="no" + fi + + if [[ -z $( contains "${APP_NAME}-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm because we have no TAR" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_TAR="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + export SHOULD_BUILD_APPIMAGE="no" + + if [[ -z $( contains "${APP_NAME_LC}-cli-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux arm because we have no CLI archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_CLI="no" + fi + + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Linux arm builds" + fi + fi + + # linux-ppc64le + if [[ "${VSCODE_ARCH}" == "ppc64le" || "${CHECK_ALL}" == "yes" ]]; then + export SHOULD_BUILD_APPIMAGE="no" + + if [[ -z $( contains "ppc64el.deb" ) ]]; then + echo "Building on Linux PowerPC64LE because we have no DEB" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_DEB="no" + fi + + if [[ -z $( contains "ppc64le.rpm" ) ]]; then + echo "Building on Linux PowerPC64LE because we have no RPM" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_RPM="no" + fi + + if [[ -z $( contains "${APP_NAME}-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux PowerPC64LE because we have no TAR" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_TAR="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux PowerPC64LE because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux PowerPC64LE because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-cli-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux PowerPC64LE because we have no CLI archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_CLI="no" + fi + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Linux PowerPC64LE builds" + fi + fi + + # linux-riscv64 + if [[ "${VSCODE_ARCH}" == "riscv64" || "${CHECK_ALL}" == "yes" ]]; then + export SHOULD_BUILD_DEB="no" + export SHOULD_BUILD_RPM="no" + export SHOULD_BUILD_APPIMAGE="no" + + if [[ -z $( contains "${APP_NAME}-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux RISC-V 64 because we have no TAR" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_TAR="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux RISC-V 64 because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux RISC-V 64 because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + export SHOULD_BUILD_CLI="no" + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Linux riscv64 builds" + fi + fi + + # linux-loong64 + if [[ "${VSCODE_ARCH}" == "loong64" || "${CHECK_ALL}" == "yes" ]]; then + export SHOULD_BUILD_DEB="no" + export SHOULD_BUILD_RPM="no" + export SHOULD_BUILD_APPIMAGE="no" + + if [[ -z $( contains "${APP_NAME}-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux Loong64 because we have no TAR" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_TAR="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux Loong64 because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux Loong64 because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + export SHOULD_BUILD_CLI="no" + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Linux Loong64 builds" + fi + fi + + # linux-s390x + if [[ "${VSCODE_ARCH}" == "s390x" || "${CHECK_ALL}" == "yes" ]]; then + SHOULD_BUILD_APPIMAGE="no" + SHOULD_BUILD_DEB="no" + SHOULD_BUILD_RPM="no" + SHOULD_BUILD_TAR="no" + + if [[ -z $( contains "${APP_NAME_LC}-reh-linux-s390x-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux s390x because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-reh-web-linux-s390x-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux s390x because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + export SHOULD_BUILD_CLI="no" + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Linux s390x builds" + fi + fi + + # linux-x64 + if [[ "${VSCODE_ARCH}" == "x64" || "${CHECK_ALL}" == "yes" ]]; then + if [[ -z $( contains "amd64.deb" ) ]]; then + echo "Building on Linux x64 because we have no DEB" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_DEB="no" + fi + + if [[ -z $( contains "x86_64.rpm" ) ]]; then + echo "Building on Linux x64 because we have no RPM" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_RPM="no" + fi + + if [[ -z $( contains "${APP_NAME}-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux x64 because we have no TAR" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_TAR="no" + fi + + if [[ "${DISABLE_APPIMAGE}" == "yes" ]]; then + export SHOULD_BUILD_APPIMAGE="no" + elif [[ -z $( contains "x86_64.AppImage" ) ]]; then + echo "Building on Linux x64 because we have no AppImage" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_APPIMAGE="no" + fi + + if [[ -z $( contains "amd64.snap" ) || "${FORCE_LINUX_SNAP}" == "true" ]]; then + echo "Building on Linux x64 because we have no SNAP" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_SNAP="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux x64 because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux x64 because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-cli-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Linux x64 because we have no CLI archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_CLI="no" + fi + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Linux x64 builds" + fi + fi +fi diff --git a/build/linux/prepare_assets.sh b/build/linux/prepare_assets.sh new file mode 100644 index 0000000..8100b81 --- /dev/null +++ b/build/linux/prepare_assets.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +cd vscode || { echo "'vscode' dir not found"; exit 1; } + +if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" && "${VSCODE_ARCH}" != "x64" ]]; then + SHOULD_BUILD_APPIMAGE="no" +fi + +if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then + npm run gulp "vscode-linux-${VSCODE_ARCH}-prepare-deb" + npm run gulp "vscode-linux-${VSCODE_ARCH}-build-deb" +fi + +if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then + npm run gulp "vscode-linux-${VSCODE_ARCH}-prepare-rpm" + npm run gulp "vscode-linux-${VSCODE_ARCH}-build-rpm" +fi + +if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then + . ../build/linux/appimage/build.sh +fi + +cd .. + +if [[ "${CI_BUILD}" == "no" ]]; then + . ./stores/snapcraft/build.sh + + if [[ "${SKIP_ASSETS}" == "no" ]]; then + mv stores/snapcraft/build/*.snap assets/ + fi +fi + +if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then + echo "Building and moving TAR" + cd "VSCode-linux-${VSCODE_ARCH}" + tar czf "../assets/${APP_NAME}-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" . + cd .. +fi + +if [[ "${SHOULD_BUILD_DEB}" != "no" ]]; then + echo "Moving DEB" + mv vscode/.build/linux/deb/*/deb/*.deb assets/ +fi + +if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then + echo "Moving RPM" + mv vscode/.build/linux/rpm/*/*.rpm assets/ +fi + +if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then + echo "Moving AppImage" + mv build/linux/appimage/out/*.AppImage* assets/ + + find assets -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \; +fi diff --git a/build/osx/check_tags.sh b/build/osx/check_tags.sh new file mode 100644 index 0000000..33be9f6 --- /dev/null +++ b/build/osx/check_tags.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +if [[ -z $( contains "${APP_NAME}-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ) ]]; then + echo "Building on MacOS because we have no ZIP" + export SHOULD_BUILD="yes" +else + export SHOULD_BUILD_ZIP="no" +fi + +if [[ -z $( contains ".${VSCODE_ARCH}.${RELEASE_VERSION}.dmg" ) ]]; then + echo "Building on MacOS because we have no DMG" + export SHOULD_BUILD="yes" +else + export SHOULD_BUILD_DMG="no" +fi + +if [[ -z $( contains "${APP_NAME_LC}-reh-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on MacOS because we have no REH archive" + export SHOULD_BUILD="yes" +else + export SHOULD_BUILD_REH="no" +fi + +if [[ -z $( contains "${APP_NAME_LC}-reh-web-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on MacOS because we have no REH-web archive" + export SHOULD_BUILD="yes" +else + export SHOULD_BUILD_REH_WEB="no" +fi + +if [[ -z $( contains "${APP_NAME_LC}-cli-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on MacOS because we have no CLI archive" + export SHOULD_BUILD="yes" +else + export SHOULD_BUILD_CLI="no" +fi + +if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the MacOS builds" +fi diff --git a/build/osx/prepare_assets.sh b/build/osx/prepare_assets.sh new file mode 100644 index 0000000..8bc2d19 --- /dev/null +++ b/build/osx/prepare_assets.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +if [[ -n "${CERTIFICATE_OSX_P12_DATA}" ]]; then + if [[ "${CI_BUILD}" == "no" ]]; then + RUNNER_TEMP="${TMPDIR}" + fi + + CERTIFICATE_P12="${APP_NAME}.p12" + KEYCHAIN="${RUNNER_TEMP}/buildagent.keychain" + AGENT_TEMPDIRECTORY="${RUNNER_TEMP}" + # shellcheck disable=SC2006 + KEYCHAINS=`security list-keychains | xargs` + + rm -f "${KEYCHAIN}" + + echo "${CERTIFICATE_OSX_P12_DATA}" | base64 --decode > "${CERTIFICATE_P12}" + + echo "+ create temporary keychain" + security create-keychain -p pwd "${KEYCHAIN}" + security set-keychain-settings -lut 21600 "${KEYCHAIN}" + security unlock-keychain -p pwd "${KEYCHAIN}" + # shellcheck disable=SC2086 + security list-keychains -s $KEYCHAINS "${KEYCHAIN}" + # security show-keychain-info "${KEYCHAIN}" + + echo "+ import certificate to keychain" + security import "${CERTIFICATE_P12}" -k "${KEYCHAIN}" -P "${CERTIFICATE_OSX_P12_PASSWORD}" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd "${KEYCHAIN}" > /dev/null + # security find-identity "${KEYCHAIN}" + + CODESIGN_IDENTITY="$( security find-identity -v -p codesigning "${KEYCHAIN}" | grep -oEi "([0-9A-F]{40})" | head -n 1 )" + + echo "+ signing" + export CODESIGN_IDENTITY AGENT_TEMPDIRECTORY + + DEBUG="electron-osx-sign*" node vscode/build/darwin/sign.ts "$( pwd )" + # codesign --display --entitlements :- "" + + echo "+ notarize" + + cd "VSCode-darwin-${VSCODE_ARCH}" + ZIP_FILE="./${APP_NAME}-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" + + zip -r -X -y "${ZIP_FILE}" ./*.app + + xcrun notarytool store-credentials "${APP_NAME}" --apple-id "${CERTIFICATE_OSX_ID}" --team-id "${CERTIFICATE_OSX_TEAM_ID}" --password "${CERTIFICATE_OSX_APP_PASSWORD}" --keychain "${KEYCHAIN}" + # xcrun notarytool history --keychain-profile "${APP_NAME}" --keychain "${KEYCHAIN}" + xcrun notarytool submit "${ZIP_FILE}" --keychain-profile "${APP_NAME}" --wait --keychain "${KEYCHAIN}" + + echo "+ attach staple" + xcrun stapler staple ./*.app + # spctl --assess -vv --type install ./*.app + + rm "${ZIP_FILE}" + + cd .. +fi + +if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then + echo "Building and moving ZIP" + cd "VSCode-darwin-${VSCODE_ARCH}" + zip -r -X -y "../assets/${APP_NAME}-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ./*.app + cd .. +fi + +if [[ -n "${CERTIFICATE_OSX_P12_DATA}" && "${SHOULD_BUILD_DMG}" != "no" ]]; then + echo "Building and moving DMG" + pushd "VSCode-darwin-${VSCODE_ARCH}" + npx create-dmg ./*.app . + mv ./*.dmg "../assets/${APP_NAME}.${VSCODE_ARCH}.${RELEASE_VERSION}.dmg" + popd +fi + +if [[ "${SHOULD_BUILD_SRC}" == "yes" ]]; then + 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 +fi + +if [[ -n "${CERTIFICATE_OSX_P12_DATA}" ]]; then + echo "+ clean" + security delete-keychain "${KEYCHAIN}" + # shellcheck disable=SC2086 + security list-keychains -s $KEYCHAINS +fi diff --git a/build/windows/check_tags.sh b/build/windows/check_tags.sh new file mode 100644 index 0000000..0f8b5c9 --- /dev/null +++ b/build/windows/check_tags.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# windows-arm64 +if [[ "${VSCODE_ARCH}" == "arm64" ]]; then + if [[ -z $( contains "${APP_NAME}Setup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then + echo "Building on Windows arm64 because we have no system setup" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_EXE_SYS="no" + fi + + if [[ -z $( contains "UserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then + echo "Building on Windows arm64 because we have no user setup" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_EXE_USR="no" + fi + + if [[ -z $( contains "${APP_NAME}-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ) ]]; then + echo "Building on Windows arm64 because we have no zip" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_ZIP="no" + fi + + export SHOULD_BUILD_REH="no" + export SHOULD_BUILD_REH_WEB="no" + + if [[ -z $( contains "${APP_NAME_LC}-cli-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Windows arm64 because we have no CLI archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_CLI="no" + fi + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Windows arm64 builds" + fi + +# windows-x64 +else + if [[ -z $( contains "${APP_NAME}Setup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then + echo "Building on Windows x64 because we have no system setup" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_EXE_SYS="no" + fi + + if [[ -z $( contains "UserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then + echo "Building on Windows x64 because we have no user setup" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_EXE_USR="no" + fi + + if [[ -z $( contains "${APP_NAME}-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ) ]]; then + echo "Building on Windows x64 because we have no zip" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_ZIP="no" + fi + + if [[ "${DISABLE_MSI}" == "yes" ]]; then + export SHOULD_BUILD_MSI="no" + elif [[ -z $( contains "${APP_NAME}-${VSCODE_ARCH}-${RELEASE_VERSION}.msi" ) ]]; then + echo "Building on Windows x64 because we have no msi" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_MSI="no" + fi + + if [[ "${DISABLE_MSI}" == "yes" ]]; then + export SHOULD_BUILD_MSI_NOUP="no" + elif [[ -z $( contains "${APP_NAME}-${VSCODE_ARCH}-updates-disabled-${RELEASE_VERSION}.msi" ) ]]; then + echo "Building on Windows x64 because we have no updates-disabled msi" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_MSI_NOUP="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-reh-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Windows x64 because we have no REH archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-reh-web-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Windows x64 because we have no REH-web archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_REH_WEB="no" + fi + + if [[ -z $( contains "${APP_NAME_LC}-cli-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then + echo "Building on Windows x64 because we have no CLI archive" + export SHOULD_BUILD="yes" + else + export SHOULD_BUILD_CLI="no" + fi + + if [[ "${SHOULD_BUILD}" != "yes" ]]; then + echo "Already have all the Windows x64 builds" + fi +fi diff --git a/build/windows/prepare_assets.sh b/build/windows/prepare_assets.sh new file mode 100644 index 0000000..346c220 --- /dev/null +++ b/build/windows/prepare_assets.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +cd vscode || { echo "'vscode' dir not found"; exit 1; } + +npm run gulp "vscode-win32-${VSCODE_ARCH}-inno-updater" + +if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then + 7z.exe a -tzip "../assets/${APP_NAME}-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" -x!CodeSignSummary*.md -x!tools "../VSCode-win32-${VSCODE_ARCH}/*" -r +fi + +# . ../build/windows/appx/build.sh + +if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then + npm run gulp "vscode-win32-${VSCODE_ARCH}-system-setup" +fi + +if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then + npm run 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 .. + +if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then + echo "Moving System EXE" + mv "vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe" "assets\\${APP_NAME}Setup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" +fi + +if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then + echo "Moving User EXE" + mv "vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe" "assets\\${APP_NAME}UserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" +fi + +if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then + if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then + echo "Moving MSI" + mv "build\\windows\\msi\\releasedir\\${APP_NAME}-${VSCODE_ARCH}-${RELEASE_VERSION}.msi" assets/ + fi + + if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then + echo "Moving MSI with disabled updates" + mv "build\\windows\\msi\\releasedir\\${APP_NAME}-${VSCODE_ARCH}-updates-disabled-${RELEASE_VERSION}.msi" assets/ + fi +fi diff --git a/check_tags.sh b/check_tags.sh index aa4b9d5..053bb5f 100755 --- a/check_tags.sh +++ b/check_tags.sh @@ -83,550 +83,16 @@ elif [[ "${ASSETS}" != "null" ]]; then fi # macos elif [[ "${OS_NAME}" == "osx" ]]; then - if [[ -z $( contains "${APP_NAME}-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ) ]]; then - echo "Building on MacOS because we have no ZIP" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_ZIP="no" - fi - - if [[ -z $( contains ".${VSCODE_ARCH}.${RELEASE_VERSION}.dmg" ) ]]; then - echo "Building on MacOS because we have no DMG" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_DMG="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-reh-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on MacOS because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-reh-web-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on MacOS because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-cli-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on MacOS because we have no CLI archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_CLI="no" - fi - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the MacOS builds" - fi + . ./build/osx/check_tags.sh elif [[ "${OS_NAME}" == "windows" ]]; then - - # windows-arm64 - if [[ "${VSCODE_ARCH}" == "arm64" ]]; then - if [[ -z $( contains "${APP_NAME}Setup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then - echo "Building on Windows arm64 because we have no system setup" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_EXE_SYS="no" - fi - - if [[ -z $( contains "UserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then - echo "Building on Windows arm64 because we have no user setup" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_EXE_USR="no" - fi - - if [[ -z $( contains "${APP_NAME}-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ) ]]; then - echo "Building on Windows arm64 because we have no zip" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_ZIP="no" - fi - - export SHOULD_BUILD_REH="no" - export SHOULD_BUILD_REH_WEB="no" - - if [[ -z $( contains "${APP_NAME_LC}-cli-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Windows arm64 because we have no CLI archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_CLI="no" - fi - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Windows arm64 builds" - fi - - # windows-x64 - else - if [[ -z $( contains "${APP_NAME}Setup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then - echo "Building on Windows x64 because we have no system setup" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_EXE_SYS="no" - fi - - if [[ -z $( contains "UserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" ) ]]; then - echo "Building on Windows x64 because we have no user setup" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_EXE_USR="no" - fi - - if [[ -z $( contains "${APP_NAME}-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ) ]]; then - echo "Building on Windows x64 because we have no zip" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_ZIP="no" - fi - - if [[ "${DISABLE_MSI}" == "yes" ]]; then - export SHOULD_BUILD_MSI="no" - elif [[ -z $( contains "${APP_NAME}-${VSCODE_ARCH}-${RELEASE_VERSION}.msi" ) ]]; then - echo "Building on Windows x64 because we have no msi" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_MSI="no" - fi - - if [[ "${DISABLE_MSI}" == "yes" ]]; then - export SHOULD_BUILD_MSI_NOUP="no" - elif [[ -z $( contains "${APP_NAME}-${VSCODE_ARCH}-updates-disabled-${RELEASE_VERSION}.msi" ) ]]; then - echo "Building on Windows x64 because we have no updates-disabled msi" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_MSI_NOUP="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-reh-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Windows x64 because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-reh-web-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Windows x64 because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-cli-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Windows x64 because we have no CLI archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_CLI="no" - fi - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Windows x64 builds" - fi - fi + . ./build/windows/check_tags.sh else if [[ "${OS_NAME}" == "linux" ]]; then - if [[ "${CHECK_ONLY_REH}" == "yes" ]]; then - - if [[ -z $( contains "${APP_NAME_LC}-reh-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux ${VSCODE_ARCH} because we have no REH archive" - export SHOULD_BUILD="yes" - else - echo "Already have the Linux REH ${VSCODE_ARCH} archive" - export SHOULD_BUILD_REH="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-reh-web-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux ${VSCODE_ARCH} because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - echo "Already have the Linux REH-web ${VSCODE_ARCH} archive" - export SHOULD_BUILD_REH_WEB="no" - fi - - else - - # linux-arm64 - if [[ "${VSCODE_ARCH}" == "arm64" || "${CHECK_ALL}" == "yes" ]]; then - if [[ -z $( contains "arm64.deb" ) ]]; then - echo "Building on Linux arm64 because we have no DEB" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_DEB="no" - fi - - if [[ -z $( contains "aarch64.rpm" ) ]]; then - echo "Building on Linux arm64 because we have no RPM" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_RPM="no" - fi - - if [[ -z $( contains "${APP_NAME}-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm64 because we have no TAR" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_TAR="no" - fi - - if [[ -z $( contains "arm64.snap" ) || "${FORCE_LINUX_SNAP}" == "true" ]]; then - echo "Building on Linux arm64 because we have no SNAP" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_SNAP="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm64 because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm64 because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - export SHOULD_BUILD_APPIMAGE="no" - - if [[ -z $( contains "${APP_NAME_LC}-cli-linux-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm64 because we have no CLI archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_CLI="no" - fi - - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Linux arm64 builds" - fi - fi - - # linux-armhf - if [[ "${VSCODE_ARCH}" == "armhf" || "${CHECK_ALL}" == "yes" ]]; then - if [[ -z $( contains "armhf.deb" ) ]]; then - echo "Building on Linux arm because we have no DEB" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_DEB="no" - fi - - if [[ -z $( contains "armv7hl.rpm" ) ]]; then - echo "Building on Linux arm because we have no RPM" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_RPM="no" - fi - - if [[ -z $( contains "${APP_NAME}-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm because we have no TAR" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_TAR="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - export SHOULD_BUILD_APPIMAGE="no" - - if [[ -z $( contains "${APP_NAME_LC}-cli-linux-armhf-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux arm because we have no CLI archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_CLI="no" - fi - - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Linux arm builds" - fi - fi - - # linux-ppc64le - if [[ "${VSCODE_ARCH}" == "ppc64le" || "${CHECK_ALL}" == "yes" ]]; then - export SHOULD_BUILD_APPIMAGE="no" - - if [[ -z $( contains "ppc64el.deb" ) ]]; then - echo "Building on Linux PowerPC64LE because we have no DEB" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_DEB="no" - fi - - if [[ -z $( contains "ppc64le.rpm" ) ]]; then - echo "Building on Linux PowerPC64LE because we have no RPM" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_RPM="no" - fi - - if [[ -z $( contains "${APP_NAME}-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux PowerPC64LE because we have no TAR" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_TAR="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux PowerPC64LE because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux PowerPC64LE because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-cli-linux-ppc64le-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux PowerPC64LE because we have no CLI archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_CLI="no" - fi - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Linux PowerPC64LE builds" - fi - fi - - # linux-riscv64 - if [[ "${VSCODE_ARCH}" == "riscv64" || "${CHECK_ALL}" == "yes" ]]; then - export SHOULD_BUILD_DEB="no" - export SHOULD_BUILD_RPM="no" - export SHOULD_BUILD_APPIMAGE="no" - - if [[ -z $( contains "${APP_NAME}-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux RISC-V 64 because we have no TAR" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_TAR="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux RISC-V 64 because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux RISC-V 64 because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - export SHOULD_BUILD_CLI="no" - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Linux riscv64 builds" - fi - fi - - # linux-loong64 - if [[ "${VSCODE_ARCH}" == "loong64" || "${CHECK_ALL}" == "yes" ]]; then - export SHOULD_BUILD_DEB="no" - export SHOULD_BUILD_RPM="no" - export SHOULD_BUILD_APPIMAGE="no" - - if [[ -z $( contains "${APP_NAME}-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux Loong64 because we have no TAR" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_TAR="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux Loong64 because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux Loong64 because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - export SHOULD_BUILD_CLI="no" - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Linux Loong64 builds" - fi - fi - - # linux-s390x - if [[ "${VSCODE_ARCH}" == "s390x" || "${CHECK_ALL}" == "yes" ]]; then - SHOULD_BUILD_APPIMAGE="no" - SHOULD_BUILD_DEB="no" - SHOULD_BUILD_RPM="no" - SHOULD_BUILD_TAR="no" - - if [[ -z $( contains "${APP_NAME_LC}-reh-linux-s390x-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux s390x because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-reh-web-linux-s390x-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux s390x because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - export SHOULD_BUILD_CLI="no" - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Linux s390x builds" - fi - fi - - # linux-x64 - if [[ "${VSCODE_ARCH}" == "x64" || "${CHECK_ALL}" == "yes" ]]; then - if [[ -z $( contains "amd64.deb" ) ]]; then - echo "Building on Linux x64 because we have no DEB" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_DEB="no" - fi - - if [[ -z $( contains "x86_64.rpm" ) ]]; then - echo "Building on Linux x64 because we have no RPM" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_RPM="no" - fi - - if [[ -z $( contains "${APP_NAME}-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux x64 because we have no TAR" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_TAR="no" - fi - - if [[ "${DISABLE_APPIMAGE}" == "yes" ]]; then - export SHOULD_BUILD_APPIMAGE="no" - elif [[ -z $( contains "x86_64.AppImage" ) ]]; then - echo "Building on Linux x64 because we have no AppImage" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_APPIMAGE="no" - fi - - if [[ -z $( contains "amd64.snap" ) || "${FORCE_LINUX_SNAP}" == "true" ]]; then - echo "Building on Linux x64 because we have no SNAP" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_SNAP="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux x64 because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux x64 because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-cli-linux-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Linux x64 because we have no CLI archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_CLI="no" - fi - - if [[ "${SHOULD_BUILD}" != "yes" ]]; then - echo "Already have all the Linux x64 builds" - fi - fi - fi + . ./build/linux/check_tags.sh fi if [[ "${OS_NAME}" == "alpine" ]] || [[ "${OS_NAME}" == "linux" && "${CHECK_ALL}" == "yes" ]]; then - - if [[ "${CHECK_ONLY_REH}" == "yes" ]]; then - if [[ -z $( contains "${APP_NAME_LC}-reh-alpine-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Alpine ${VSCODE_ARCH} because we have no REH archive" - export SHOULD_BUILD="yes" - else - echo "Already have the Alpine REH ${VSCODE_ARCH} archive" - export SHOULD_BUILD_REH="no" - fi - - if [[ -z $( contains "${APP_NAME_LC}-reh-web-alpine-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Alpine ${VSCODE_ARCH} because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - echo "Already have the Alpine REH-web ${VSCODE_ARCH} archive" - export SHOULD_BUILD_REH_WEB="no" - fi - else - - # alpine-arm64 - if [[ "${VSCODE_ARCH}" == "arm64" || "${CHECK_ALL}" == "yes" ]]; then - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-alpine-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Alpine arm64 because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-alpine-arm64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Alpine arm64 because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - fi - - # alpine-x64 - if [[ "${VSCODE_ARCH}" == "x64" || "${CHECK_ALL}" == "yes" ]]; then - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-alpine-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Alpine x64 because we have no REH archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH="no" - fi - - if [[ "${CHECK_REH}" != "no" && -z $( contains "${APP_NAME_LC}-reh-web-alpine-x64-${RELEASE_VERSION}.tar.gz" ) ]]; then - echo "Building on Alpine x64 because we have no REH-web archive" - export SHOULD_BUILD="yes" - else - export SHOULD_BUILD_REH_WEB="no" - fi - fi - fi + . ./build/alpine/check_tags.sh fi fi else diff --git a/prepare_assets.sh b/prepare_assets.sh index 269cefa..5abfd56 100755 --- a/prepare_assets.sh +++ b/prepare_assets.sh @@ -8,198 +8,15 @@ APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )" mkdir -p assets if [[ "${OS_NAME}" == "osx" ]]; then - if [[ -n "${CERTIFICATE_OSX_P12_DATA}" ]]; then - if [[ "${CI_BUILD}" == "no" ]]; then - RUNNER_TEMP="${TMPDIR}" - fi - - CERTIFICATE_P12="${APP_NAME}.p12" - KEYCHAIN="${RUNNER_TEMP}/buildagent.keychain" - AGENT_TEMPDIRECTORY="${RUNNER_TEMP}" - # shellcheck disable=SC2006 - KEYCHAINS=`security list-keychains | xargs` - - rm -f "${KEYCHAIN}" - - echo "${CERTIFICATE_OSX_P12_DATA}" | base64 --decode > "${CERTIFICATE_P12}" - - echo "+ create temporary keychain" - security create-keychain -p pwd "${KEYCHAIN}" - security set-keychain-settings -lut 21600 "${KEYCHAIN}" - security unlock-keychain -p pwd "${KEYCHAIN}" - # shellcheck disable=SC2086 - security list-keychains -s $KEYCHAINS "${KEYCHAIN}" - # security show-keychain-info "${KEYCHAIN}" - - echo "+ import certificate to keychain" - security import "${CERTIFICATE_P12}" -k "${KEYCHAIN}" -P "${CERTIFICATE_OSX_P12_PASSWORD}" -T /usr/bin/codesign - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd "${KEYCHAIN}" > /dev/null - # security find-identity "${KEYCHAIN}" - - CODESIGN_IDENTITY="$( security find-identity -v -p codesigning "${KEYCHAIN}" | grep -oEi "([0-9A-F]{40})" | head -n 1 )" - - echo "+ signing" - export CODESIGN_IDENTITY AGENT_TEMPDIRECTORY - - DEBUG="electron-osx-sign*" node vscode/build/darwin/sign.ts "$( pwd )" - # codesign --display --entitlements :- "" - - echo "+ notarize" - - cd "VSCode-darwin-${VSCODE_ARCH}" - ZIP_FILE="./${APP_NAME}-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" - - zip -r -X -y "${ZIP_FILE}" ./*.app - - xcrun notarytool store-credentials "${APP_NAME}" --apple-id "${CERTIFICATE_OSX_ID}" --team-id "${CERTIFICATE_OSX_TEAM_ID}" --password "${CERTIFICATE_OSX_APP_PASSWORD}" --keychain "${KEYCHAIN}" - # xcrun notarytool history --keychain-profile "${APP_NAME}" --keychain "${KEYCHAIN}" - xcrun notarytool submit "${ZIP_FILE}" --keychain-profile "${APP_NAME}" --wait --keychain "${KEYCHAIN}" - - echo "+ attach staple" - xcrun stapler staple ./*.app - # spctl --assess -vv --type install ./*.app - - rm "${ZIP_FILE}" - - cd .. - fi - - if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then - echo "Building and moving ZIP" - cd "VSCode-darwin-${VSCODE_ARCH}" - zip -r -X -y "../assets/${APP_NAME}-darwin-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" ./*.app - cd .. - fi - - if [[ -n "${CERTIFICATE_OSX_P12_DATA}" && "${SHOULD_BUILD_DMG}" != "no" ]]; then - echo "Building and moving DMG" - pushd "VSCode-darwin-${VSCODE_ARCH}" - npx create-dmg ./*.app . - mv ./*.dmg "../assets/${APP_NAME}.${VSCODE_ARCH}.${RELEASE_VERSION}.dmg" - popd - fi - - if [[ "${SHOULD_BUILD_SRC}" == "yes" ]]; then - 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 - fi - - if [[ -n "${CERTIFICATE_OSX_P12_DATA}" ]]; then - echo "+ clean" - security delete-keychain "${KEYCHAIN}" - # shellcheck disable=SC2086 - security list-keychains -s $KEYCHAINS - fi + . ./build/osx/prepare_assets.sh VSCODE_PLATFORM="darwin" elif [[ "${OS_NAME}" == "windows" ]]; then - cd vscode || { echo "'vscode' dir not found"; exit 1; } - - npm run gulp "vscode-win32-${VSCODE_ARCH}-inno-updater" - - if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then - 7z.exe a -tzip "../assets/${APP_NAME}-win32-${VSCODE_ARCH}-${RELEASE_VERSION}.zip" -x!CodeSignSummary*.md -x!tools "../VSCode-win32-${VSCODE_ARCH}/*" -r - fi - - # . ../build/windows/appx/build.sh - - if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then - npm run gulp "vscode-win32-${VSCODE_ARCH}-system-setup" - fi - - if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then - npm run 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 .. - - if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then - echo "Moving System EXE" - mv "vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe" "assets\\${APP_NAME}Setup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" - fi - - if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then - echo "Moving User EXE" - mv "vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe" "assets\\${APP_NAME}UserSetup-${VSCODE_ARCH}-${RELEASE_VERSION}.exe" - fi - - if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then - if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then - echo "Moving MSI" - mv "build\\windows\\msi\\releasedir\\${APP_NAME}-${VSCODE_ARCH}-${RELEASE_VERSION}.msi" assets/ - fi - - if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then - echo "Moving MSI with disabled updates" - mv "build\\windows\\msi\\releasedir\\${APP_NAME}-${VSCODE_ARCH}-updates-disabled-${RELEASE_VERSION}.msi" assets/ - fi - fi + . ./build/windows/prepare_assets.sh VSCODE_PLATFORM="win32" else - cd vscode || { echo "'vscode' dir not found"; exit 1; } - - if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" && "${VSCODE_ARCH}" != "x64" ]]; then - SHOULD_BUILD_APPIMAGE="no" - fi - - if [[ "${SHOULD_BUILD_DEB}" != "no" || "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then - npm run gulp "vscode-linux-${VSCODE_ARCH}-prepare-deb" - npm run gulp "vscode-linux-${VSCODE_ARCH}-build-deb" - fi - - if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then - npm run gulp "vscode-linux-${VSCODE_ARCH}-prepare-rpm" - npm run gulp "vscode-linux-${VSCODE_ARCH}-build-rpm" - fi - - if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then - . ../build/linux/appimage/build.sh - fi - - cd .. - - if [[ "${CI_BUILD}" == "no" ]]; then - . ./stores/snapcraft/build.sh - - if [[ "${SKIP_ASSETS}" == "no" ]]; then - mv stores/snapcraft/build/*.snap assets/ - fi - fi - - if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then - echo "Building and moving TAR" - cd "VSCode-linux-${VSCODE_ARCH}" - tar czf "../assets/${APP_NAME}-linux-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" . - cd .. - fi - - if [[ "${SHOULD_BUILD_DEB}" != "no" ]]; then - echo "Moving DEB" - mv vscode/.build/linux/deb/*/deb/*.deb assets/ - fi - - if [[ "${SHOULD_BUILD_RPM}" != "no" ]]; then - echo "Moving RPM" - mv vscode/.build/linux/rpm/*/*.rpm assets/ - fi - - if [[ "${SHOULD_BUILD_APPIMAGE}" != "no" ]]; then - echo "Moving AppImage" - mv build/linux/appimage/out/*.AppImage* assets/ - - find assets -name '*.AppImage*' -exec bash -c 'mv $0 ${0/_-_/-}' {} \; - fi + . ./build/linux/prepare_assets.sh VSCODE_PLATFORM="linux" fi