Simplify packaging and improve scripts
Much better test now as well.
This commit is contained in:
@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Generates static code-server releases for CI.
|
||||
# This script assumes that a static release is built already.
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
VERSION="$(pkg_json_version)"
|
||||
|
||||
local OS
|
||||
OS="$(os)"
|
||||
|
||||
local ARCH
|
||||
ARCH="$(arch)"
|
||||
|
||||
local archive_name="code-server-$VERSION-$OS-$ARCH"
|
||||
mkdir -p release-github
|
||||
|
||||
local ext
|
||||
if [[ $OS == "linux" ]]; then
|
||||
ext=".tar.gz"
|
||||
tar -czf "release-github/$archive_name$ext" --transform "s/^\.\/release-static/$archive_name/" ./release-static
|
||||
else
|
||||
mv ./release-static "./$archive_name"
|
||||
ext=".zip"
|
||||
zip -r "release-github/$archive_name$ext" "./$archive_name"
|
||||
mv "./$archive_name" ./release-static
|
||||
fi
|
||||
|
||||
echo "done (release-github/$archive_name)"
|
||||
|
||||
mkdir -p "release-gcp/$VERSION"
|
||||
cp "release-github/$archive_name$ext" "./release-gcp/$VERSION/$OS-$ARCH$ext"
|
||||
mkdir -p "release-gcp/latest"
|
||||
cp "./release-github/$archive_name$ext" "./release-gcp/latest/$OS-$ARCH$ext"
|
||||
}
|
||||
|
||||
main "$@"
|
59
ci/build/build-packages.sh
Executable file
59
ci/build/build-packages.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Packages code-server for the current OS and architecture into ./release-packages.
|
||||
# This script assumes that a static release is built already into ./release-static.
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
export VERSION
|
||||
VERSION="$(pkg_json_version)"
|
||||
|
||||
local OS
|
||||
OS="$(os)"
|
||||
|
||||
export ARCH
|
||||
ARCH="$(arch)"
|
||||
|
||||
local archive_name="code-server-$VERSION-$OS-$ARCH"
|
||||
mkdir -p release-packages
|
||||
|
||||
local ext
|
||||
if [[ $OS == "linux" ]]; then
|
||||
ext=".tar.gz"
|
||||
tar -czf "release-packages/$archive_name$ext" --transform "s/^\.\/release-static/$archive_name/" ./release-static
|
||||
else
|
||||
mv ./release-static "./$archive_name"
|
||||
ext=".zip"
|
||||
zip -r "release-packages/$archive_name$ext" "./$archive_name"
|
||||
mv "./$archive_name" ./release-static
|
||||
fi
|
||||
|
||||
echo "done (release-packages/$archive_name)"
|
||||
|
||||
release_gcp
|
||||
|
||||
if [[ $OSTYPE == linux* ]]; then
|
||||
release_nfpm
|
||||
fi
|
||||
}
|
||||
|
||||
release_gcp() {
|
||||
mkdir -p "release-gcp/$VERSION"
|
||||
cp "release-packages/$archive_name$ext" "./release-gcp/$VERSION/$OS-$ARCH$ext"
|
||||
mkdir -p "release-gcp/latest"
|
||||
cp "./release-packages/$archive_name$ext" "./release-gcp/latest/$OS-$ARCH$ext"
|
||||
}
|
||||
|
||||
# Generates deb and rpm packages.
|
||||
release_nfpm() {
|
||||
local nfpm_config
|
||||
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
|
||||
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-packages/code-server-"$VERSION-$ARCH.deb"
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-packages/code-server-"$VERSION-$ARCH.rpm"
|
||||
}
|
||||
|
||||
main "$@"
|
@ -1,10 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# This script requires code-server and vscode to be built with matching MINIFY.
|
||||
# This script requires vscode to be built with matching MINIFY.
|
||||
|
||||
# MINIFY controls whether minified vscode is bundled and whether
|
||||
# any included node_modules are pruned for production.
|
||||
# MINIFY controls whether minified vscode is bundled.
|
||||
MINIFY="${MINIFY-true}"
|
||||
|
||||
main() {
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Generates deb and rpm packages for CI.
|
||||
# Assumes a static release has already been built.
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
VERSION="$(pkg_json_version)"
|
||||
export VERSION
|
||||
|
||||
ARCH="$(arch)"
|
||||
export ARCH
|
||||
|
||||
local nfpm_config
|
||||
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
|
||||
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-github/code-server-"$VERSION-$ARCH.deb"
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-github/code-server-"$VERSION-$ARCH.rpm"
|
||||
}
|
||||
|
||||
main "$@"
|
0
ci/build/lib.sh
Normal file → Executable file
0
ci/build/lib.sh
Normal file → Executable file
@ -7,14 +7,21 @@ set -euo pipefail
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
local output
|
||||
output=$(./release-static/bin/code-server --list-extensions 2>&1)
|
||||
if echo "$output" | grep 'was compiled against a different Node.js version'; then
|
||||
echo "$output"
|
||||
local EXTENSIONS_DIR
|
||||
EXTENSIONS_DIR="$(mktemp -d)"
|
||||
|
||||
echo "Testing static release"
|
||||
|
||||
./release-static/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --install-extension ms-python.python
|
||||
local installed_extensions
|
||||
installed_extensions="$(./release-static/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)"
|
||||
if [[ $installed_extensions != "ms-python.python" ]]; then
|
||||
echo "Unexpected output from listing extensions:"
|
||||
echo "$installed_extensions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Build ran successfully"
|
||||
echo "Static release works correctly"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
Reference in New Issue
Block a user