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.
|
|
|
|
# This script assumes that a static release is built already into ./release-static.
|
|
|
|
|
|
|
|
main() {
|
|
|
|
cd "$(dirname "${0}")/../.."
|
|
|
|
source ./ci/lib.sh
|
|
|
|
|
|
|
|
mkdir -p release-packages
|
|
|
|
|
2020-05-20 21:38:01 +08:00
|
|
|
release_archive
|
2020-05-22 10:16:16 +08:00
|
|
|
# Will stop the auto update issues and allow people to upgrade their scripts
|
|
|
|
# for the new release structure.
|
|
|
|
if [[ $ARCH == "amd64" ]]; then
|
|
|
|
if [[ $OS == "linux" ]]; then
|
|
|
|
ARCH=x86_64 release_archive
|
|
|
|
elif [[ $OS == "macos" ]]; then
|
|
|
|
OS=darwin ARCH=x86_64 release_archive
|
|
|
|
fi
|
2020-05-20 21:38:01 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $OSTYPE == linux* ]]; then
|
|
|
|
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
|
2020-05-16 22:55:46 +08:00
|
|
|
tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-static/$release_name/" ./release-static
|
2020-05-08 12:34:20 +08:00
|
|
|
else
|
2020-05-16 22:55:46 +08:00
|
|
|
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-static/$release_name/" release-static
|
2020-05-08 12:34:20 +08:00
|
|
|
fi
|
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
|
|
|
|
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
|
|
|
|
|
2020-05-12 13:46:38 +08:00
|
|
|
# The underscores are convention for .deb.
|
2020-05-20 21:38:01 +08:00
|
|
|
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb"
|
2020-05-13 07:33:34 +08:00
|
|
|
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server-$VERSION-$ARCH.rpm"
|
2020-05-08 12:34:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|