code-server/ci/lib.sh
Asher b5611efe1a
Use VS Code packaging for releases (#7721)
* Allow setting the VS Code build target

For the NPM package (and tests, at least for now), we will still use
linux-x64, but this is going to allow using the platform build targets
for our standalone releases so we can avoid having to copy all the
packaging steps (like cleaning up modules).

This does mean that the NPM package when installed will be missing those
cleanup steps.  Possibly we can try to break out the packaging step into
a something that can be ran standalone (which will also require
installing dev dependencies like gulp) but not sure how much work this
would be.

* Preserve dependencies for e2e tests

To avoid having to install them again.

Also moved an env block to the root of the  job.

* Refactor releases to use VS Code packaging

Instead of building the linux-x64 package, stripping the modules, then
installing them again, we build the correct target and use the modules
as they are.

This means we do not have to copy all the post-processing steps like the
ones that delete unnecessary modules.

For the NPM package we still publish the linux-x64 package (without
modules of course).  This means npm installations do not get that same
post-processing.

Another advantage of this is that we can run the release immediately
without having to wait for the build step, or on a commit that no longer
has a build artifact, since they all build individually now.  We could
try sharing the core-ci build step, but leaving that alone for now.

I also converted the macOS jobs into a matrix.

Deleted the CI readme because it was out of date and seemed to just
repeat what should be described in the scripts anyway.

Removed a section about Homebrew since we do not maintain that anymore.

It looks like there is no need to symlink node_modules.asar anymore.
2026-03-27 17:08:35 -08:00

85 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
pushd() {
builtin pushd "$@" > /dev/null
}
popd() {
builtin popd > /dev/null
}
vscode_version() {
jq -r .version lib/vscode/package.json
}
os() {
osname=$(uname | tr '[:upper:]' '[:lower:]')
case $osname in
linux)
# Alpine's ldd doesn't have a version flag but if you use an invalid flag
# (like --version) it outputs the version to stderr and exits with 1.
# TODO: Better to check /etc/os-release; see ../install.sh.
ldd_output=$(ldd --version 2>&1 || true)
if echo "$ldd_output" | grep -iq musl; then
osname="alpine"
fi
;;
darwin) osname="macos" ;;
cygwin* | mingw*) osname="windows" ;;
esac
echo "$osname"
}
arch() {
cpu="$(uname -m)"
case "$cpu" in
aarch64) cpu=arm64 ;;
x86_64) cpu=amd64 ;;
esac
echo "$cpu"
}
rsync() {
command rsync -a --del "$@"
}
if [[ ! ${ARCH-} ]]; then
ARCH=$(arch)
export ARCH
fi
if [[ ! ${OS-} ]]; then
OS=$(os)
export OS
fi
# RELEASE_PATH is the destination directory for the release from the root.
# Defaults to release
if [[ ! ${RELEASE_PATH-} ]]; then
RELEASE_PATH="release"
export RELEASE_PATH
fi
nodeOS() {
osname=$OS
case $osname in
macos) osname=darwin ;;
windows) osname=win32 ;;
esac
echo "$osname"
}
nodeArch() {
cpu=$ARCH
case $cpu in
amd64) cpu=x64 ;;
esac
echo "$cpu"
}
# See gulpfile.reh.ts for available targets.
if [[ ! ${VSCODE_TARGET-} ]]; then
VSCODE_TARGET="$(nodeOS)-$(nodeArch)"
export VSCODE_TARGET
fi