2020-05-08 07:34:20 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# Packages code-server for the current OS and architecture into ./release-packages.
|
2020-05-27 23:39:17 +03:00
|
|
|
# This script assumes that a standalone release is built already into ./release-standalone
|
2020-05-08 07:34:20 +03:00
|
|
|
|
|
|
|
main() {
|
|
|
|
cd "$(dirname "${0}")/../.."
|
|
|
|
source ./ci/lib.sh
|
|
|
|
|
|
|
|
mkdir -p release-packages
|
|
|
|
|
2020-05-20 16:38:01 +03:00
|
|
|
release_archive
|
|
|
|
|
2020-05-27 07:55:09 +03:00
|
|
|
if [[ $OS == "linux" ]]; then
|
2020-05-20 16:38:01 +03:00
|
|
|
release_nfpm
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
release_archive() {
|
|
|
|
local release_name="code-server-$VERSION-$OS-$ARCH"
|
2020-05-08 07:34:20 +03:00
|
|
|
if [[ $OS == "linux" ]]; then
|
2020-05-27 23:39:17 +03:00
|
|
|
tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone
|
2020-05-08 07:34:20 +03:00
|
|
|
else
|
2020-05-28 01:04:36 +03:00
|
|
|
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-standalone/$release_name/" release-standalone
|
2020-05-08 07:34:20 +03:00
|
|
|
fi
|
2020-06-03 21:18:12 +03:00
|
|
|
|
2020-05-16 17:55:46 +03:00
|
|
|
echo "done (release-packages/$release_name)"
|
2020-05-08 07:34:20 +03:00
|
|
|
|
|
|
|
release_gcp
|
|
|
|
}
|
|
|
|
|
|
|
|
release_gcp() {
|
|
|
|
mkdir -p "release-gcp/$VERSION"
|
2020-05-16 17:55:46 +03:00
|
|
|
cp "release-packages/$release_name.tar.gz" "./release-gcp/$VERSION/$OS-$ARCH.tar.gz"
|
2020-05-08 07:34:20 +03:00
|
|
|
mkdir -p "release-gcp/latest"
|
2020-05-16 17:55:46 +03:00
|
|
|
cp "./release-packages/$release_name.tar.gz" "./release-gcp/latest/$OS-$ARCH.tar.gz"
|
2020-05-08 07:34:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# Generates deb and rpm packages.
|
|
|
|
release_nfpm() {
|
|
|
|
local nfpm_config
|
2021-03-16 01:36:31 +03:00
|
|
|
nfpm_config="$(envsubst <./ci/build/nfpm.yaml)"
|
2020-05-08 07:34:20 +03:00
|
|
|
|
2020-05-12 08:46:38 +03:00
|
|
|
# The underscores are convention for .deb.
|
2020-05-20 16:38:01 +03:00
|
|
|
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb"
|
2020-05-13 02:33:34 +03:00
|
|
|
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server-$VERSION-$ARCH.rpm"
|
2020-05-08 07:34:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|