vscodium/package_alpine_reh.sh

85 lines
1.7 KiB
Bash
Raw Normal View History

2024-02-26 17:32:48 +03:00
#!/usr/bin/env bash
# shellcheck disable=SC1091
set -ex
if [[ "${CI_BUILD}" == "no" ]]; then
exit 1
fi
tar -xzf ./vscode.tar.gz
cd vscode || { echo "'vscode' dir not found"; exit 1; }
export VSCODE_PLATFORM='alpine'
2024-06-06 17:54:10 +03:00
export VSCODE_SKIP_NODE_VERSION_CHECK=1
2024-02-26 17:32:48 +03:00
VSCODE_HOST_MOUNT="$( pwd )"
VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:alpine-${VSCODE_ARCH}"
2024-06-06 17:54:10 +03:00
export VSCODE_HOST_MOUNT VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME
2024-02-26 17:32:48 +03:00
2024-09-09 13:29:14 +03:00
if [[ -d "../patches/alpine/reh/" ]]; then
for file in "../patches/alpine/reh/"*.patch; do
if [[ -f "${file}" ]]; then
echo applying patch: "${file}";
if ! git apply --ignore-whitespace "${file}"; then
echo failed to apply patch "${file}" >&2
exit 1
fi
fi
done
fi
2024-02-26 17:32:48 +03:00
for i in {1..5}; do # try 5 times
npm ci && break
2024-02-26 17:32:48 +03:00
if [[ $i == 3 ]]; then
echo "Npm install failed too many times" >&2
2024-02-26 17:32:48 +03:00
exit 1
fi
echo "Npm install failed $i, trying again..."
2024-02-26 17:32:48 +03:00
done
node build/azure-pipelines/distro/mixin-npm
yarn gulp minify-vscode-reh
if [[ "${VSCODE_ARCH}" == "x64" ]]; then
PA_NAME="linux-alpine"
else
PA_NAME="alpine-arm64"
fi
yarn gulp "vscode-reh-${PA_NAME}-min-ci"
2024-02-26 17:32:48 +03:00
cd ..
APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )"
mkdir -p assets
echo "Building and moving REH"
cd "vscode-reh-${PA_NAME}"
2024-02-26 17:32:48 +03:00
tar czf "../assets/${APP_NAME_LC}-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
cd ..
npm install -g checksum
sum_file() {
if [[ -f "${1}" ]]; then
echo "Calculating checksum for ${1}"
checksum -a sha256 "${1}" > "${1}".sha256
checksum "${1}" > "${1}".sha1
fi
}
cd assets
for FILE in *; do
if [[ -f "${FILE}" ]]; then
sum_file "${FILE}"
fi
done
cd ..