forked from rust-lang/rust-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·39 lines (32 loc) · 1.09 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -euv -o pipefail
root=/home/ubuntu
binary_path=$root/playground-artifacts/ui
# Get new docker images
$root/rust-playground/compiler/fetch.sh
# Clean old docker images
docker system prune -f || true
# Get the binary's hash so we know if it has changed
previous_binary_hash=""
if [[ -f "${binary_path}" ]]; then
previous_binary_hash=$(md5sum "${binary_path}")
fi
# Get new artifacts
aws s3 sync --region=us-east-2 s3://playground-artifacts-i32 $root/playground-artifacts
# These artifacts don't change names and might stay the same size
# https://github.com/aws/aws-cli/issues/1074
aws s3 sync \
--region=us-east-2 \
--exclude='*' \
--include=ui \
--include=build/index.html \
--include=build/index.html.gz \
--include=build/robots.txt \
--exact-timestamps \
s3://playground-artifacts-i32 $root/playground-artifacts
chmod +x "${binary_path}"
# Restart to get new server binary
if [[ -z "${previous_binary_hash}" ]] || ! md5sum -c <(echo "${previous_binary_hash}") --status; then
sudo service playground stop || true
sudo service playground start
fi