Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/ci/release.sh

56 lines
1.3 KiB
Bash
Raw Normal View History

2020-01-15 19:05:27 +01:00
#!/usr/bin/env bash
# ci.bash -- Build code-server in the CI.
2019-07-12 00:12:52 +02:00
set -euo pipefail
2019-07-11 01:10:39 +02:00
# This script assumes that yarn has already ran.
2019-07-03 02:10:17 +02:00
function main() {
2020-02-04 20:27:46 +01:00
cd "$(dirname "${0}")/.."
2020-02-19 01:06:35 +01:00
source ./ci/lib.sh
2020-02-04 20:27:46 +01:00
2020-02-19 01:06:35 +01:00
set_version
# Always minify and package on CI since that's when releases are pushed.
if [[ ${CI:-} ]]; then
2020-02-04 20:27:46 +01:00
export MINIFY="true"
export PACKAGE="true"
fi
2019-07-03 02:10:17 +02:00
2020-02-04 20:27:46 +01:00
yarn build
yarn binary
2020-02-15 01:46:00 +01:00
if [[ -n ${PACKAGE:-} ]]; then
2020-02-04 20:27:46 +01:00
yarn package
fi
2019-07-03 02:10:17 +02:00
2020-02-04 20:27:46 +01:00
cd binaries
2020-02-15 01:46:00 +01:00
if [[ -n ${STRIP_BIN_TARGET:-} ]]; then
2020-02-04 20:27:46 +01:00
# In this case provide plainly named binaries.
2020-02-15 01:46:00 +01:00
for binary in code-server*; do
2020-02-04 20:27:46 +01:00
echo "Moving $binary to code-server"
mv "$binary" code-server
done
2020-02-15 01:46:00 +01:00
elif [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]]; then
2020-02-04 20:27:46 +01:00
# Prepare directory for uploading binaries on release.
2020-02-15 01:46:00 +01:00
for binary in code-server*; do
2020-02-04 20:27:46 +01:00
mkdir -p "../binary-upload"
2020-02-19 05:31:40 +01:00
local prefix="code-server-$VERSION-"
2020-02-04 20:27:46 +01:00
local target="${binary#$prefix}"
2020-02-15 01:46:00 +01:00
if [[ $target == "linux-x86_64" ]]; then
2020-02-04 20:27:46 +01:00
echo "Copying $binary to ../binary-upload/latest-linux"
cp "$binary" "../binary-upload/latest-linux"
fi
2020-02-04 20:27:46 +01:00
local gcp_dir
2020-02-19 05:31:40 +01:00
gcp_dir="../binary-upload/releases/$VERSION/$target"
2020-02-04 20:27:46 +01:00
mkdir -p "$gcp_dir"
2020-02-04 20:27:46 +01:00
echo "Copying $binary to $gcp_dir/code-server"
cp "$binary" "$gcp_dir/code-server"
done
fi
2019-07-03 02:10:17 +02:00
}
main "$@"