2020-05-08 11:34:20 +07: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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
if [[ $OS == "linux" ]]; then
|
2020-05-16 21:01:26 +07:00
|
|
|
tar -czf "release-packages/$archive_name.tar.gz" --transform "s/^\.\/release-static/$archive_name/" ./release-static
|
2020-05-08 11:34:20 +07:00
|
|
|
else
|
2020-05-16 21:01:26 +07:00
|
|
|
tar -czf "release-packages/$archive_name.tar.gz" -s "/^release-static/$archive_name/" release-static
|
2020-05-08 11:34:20 +07:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "done (release-packages/$archive_name)"
|
|
|
|
|
|
|
|
release_gcp
|
|
|
|
|
|
|
|
if [[ $OSTYPE == linux* ]]; then
|
|
|
|
release_nfpm
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
release_gcp() {
|
|
|
|
mkdir -p "release-gcp/$VERSION"
|
2020-05-16 21:01:26 +07:00
|
|
|
cp "release-packages/$archive_name.tar.gz" "./release-gcp/$VERSION/$OS-$ARCH.tar.gz"
|
2020-05-08 11:34:20 +07:00
|
|
|
mkdir -p "release-gcp/latest"
|
2020-05-16 21:01:26 +07:00
|
|
|
cp "./release-packages/$archive_name.tar.gz" "./release-gcp/latest/$OS-$ARCH.tar.gz"
|
2020-05-08 11:34:20 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Generates deb and rpm packages.
|
|
|
|
release_nfpm() {
|
|
|
|
local nfpm_config
|
|
|
|
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
|
|
|
|
|
2020-05-12 12:46:38 +07:00
|
|
|
# The underscores are convention for .deb.
|
2020-05-13 06:33:34 +07:00
|
|
|
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"
|
2020-05-08 11:34:20 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|