2020-05-08 12:34:20 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# Packages code-server for the current OS and architecture into ./release-packages.
|
2020-05-28 04:39:17 +08:00
|
|
|
# This script assumes that a standalone release is built already into ./release-standalone
|
2020-05-08 12:34:20 +08:00
|
|
|
|
|
|
|
main() {
|
|
|
|
cd "$(dirname "${0}")/../.."
|
|
|
|
source ./ci/lib.sh
|
2021-09-17 07:19:10 +08:00
|
|
|
source ./ci/build/build-lib.sh
|
2020-05-08 12:34:20 +08:00
|
|
|
|
2021-04-09 02:12:01 +08:00
|
|
|
# Allow us to override architecture
|
|
|
|
# we use this for our Linux ARM64 cross compile builds
|
|
|
|
if [ "$#" -eq 1 ] && [ "$1" ]; then
|
|
|
|
ARCH=$1
|
|
|
|
fi
|
|
|
|
|
2020-05-08 12:34:20 +08:00
|
|
|
mkdir -p release-packages
|
|
|
|
|
2020-05-20 21:38:01 +08:00
|
|
|
release_archive
|
|
|
|
|
2020-05-27 12:55:09 +08:00
|
|
|
if [[ $OS == "linux" ]]; then
|
2020-05-20 21:38:01 +08:00
|
|
|
release_nfpm
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
release_archive() {
|
|
|
|
local release_name="code-server-$VERSION-$OS-$ARCH"
|
2020-05-08 12:34:20 +08:00
|
|
|
if [[ $OS == "linux" ]]; then
|
2023-09-28 11:17:47 +08:00
|
|
|
tar -czf "release-packages/$release_name.tar.gz" --owner=0 --group=0 --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone
|
2020-05-08 12:34:20 +08:00
|
|
|
else
|
2020-05-28 06:04:36 +08:00
|
|
|
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-standalone/$release_name/" release-standalone
|
2020-05-08 12:34:20 +08:00
|
|
|
fi
|
2020-06-04 02:18:12 +08:00
|
|
|
|
2020-05-16 22:55:46 +08:00
|
|
|
echo "done (release-packages/$release_name)"
|
2020-05-08 12:34:20 +08:00
|
|
|
|
|
|
|
release_gcp
|
|
|
|
}
|
|
|
|
|
|
|
|
release_gcp() {
|
|
|
|
mkdir -p "release-gcp/$VERSION"
|
2020-05-16 22:55:46 +08:00
|
|
|
cp "release-packages/$release_name.tar.gz" "./release-gcp/$VERSION/$OS-$ARCH.tar.gz"
|
2020-05-08 12:34:20 +08:00
|
|
|
mkdir -p "release-gcp/latest"
|
2020-05-16 22:55:46 +08:00
|
|
|
cp "./release-packages/$release_name.tar.gz" "./release-gcp/latest/$OS-$ARCH.tar.gz"
|
2020-05-08 12:34:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Generates deb and rpm packages.
|
|
|
|
release_nfpm() {
|
|
|
|
local nfpm_config
|
2021-08-10 02:35:31 +08:00
|
|
|
|
2021-09-17 03:58:11 +08:00
|
|
|
export NFPM_ARCH
|
|
|
|
|
2021-08-10 02:35:31 +08:00
|
|
|
PKG_FORMAT="deb"
|
2021-09-17 07:19:10 +08:00
|
|
|
NFPM_ARCH="$(get_nfpm_arch $PKG_FORMAT "$ARCH")"
|
2021-06-29 00:36:55 +08:00
|
|
|
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"
|
2021-09-17 03:58:11 +08:00
|
|
|
echo "Building deb"
|
|
|
|
echo "$nfpm_config" | head --lines=4
|
2021-08-10 02:35:31 +08:00
|
|
|
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_${NFPM_ARCH}.deb"
|
2020-05-08 12:34:20 +08:00
|
|
|
|
2021-08-10 02:35:31 +08:00
|
|
|
PKG_FORMAT="rpm"
|
2021-09-17 07:19:10 +08:00
|
|
|
NFPM_ARCH="$(get_nfpm_arch $PKG_FORMAT "$ARCH")"
|
2021-08-10 02:35:31 +08:00
|
|
|
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"
|
2021-09-17 03:58:11 +08:00
|
|
|
echo "Building rpm"
|
|
|
|
echo "$nfpm_config" | head --lines=4
|
2021-08-10 02:35:31 +08:00
|
|
|
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server-$VERSION-$NFPM_ARCH.rpm"
|
2020-05-08 12:34:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|