-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·55 lines (46 loc) · 1.92 KB
/
deploy.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
set -euo pipefail
scriptdir=$(dirname "${BASH_SOURCE[0]}")
bucket="docs.expo.io"
target="${1-$scriptdir/out}"
if [ ! -d "$target" ]; then
echo "target $target not found"
exit 1
fi
aws s3 sync "$target" "s3://${bucket}" --delete
aws s3 cp \
--recursive \
--metadata-directive REPLACE \
--cache-control "public,max-age=31536000,immutable" \
"s3://${bucket}/_next/static/" \
"s3://${bucket}/_next/static/"
declare -A redirects # associative array variable
# usage:
# redicts[requests/for/this/path]=are/redirected/to/this/one
# Temporarily create a redirect for a page that Home links to
redirects[versions/latest/introduction/installation.html]=versions/latest/introduction/installation/
# useful link on twitter
redirects[versions/latest/guides/app-stores.html]=versions/latest/distribution/app-stores/
# Xdl caches
redirects[versions/latest/guides/offline-support.html]=versions/latest/guides/offline-support/
# xdl convert comment
redirects[versions/latest/sdk/index.html]=versions/latest/sdk/overview/
# upgrading expo -> upgrading sdk walkthrough
redirects[versions/latest/workflow/upgrading-expo]=versions/latest/workflow/upgrading-expo-sdk-walkthrough/
# rename
redirects[versions/latest/sdk/haptic/index.html]=versions/latest/sdk/haptics/
# duplicate docs file, consolidate into one page
redirects[versions/latest/sdk/introduction/index.html]=versions/latest/sdk/overview/
# project-lifecycle is now covered by managed-vs-bare
redirects[versions/latest/introduction/project-lifecycle/]=versions/latest/introduction/managed-vs-bare/
# exp-cli is now expo-cli
redirects[versions/latest/guides/exp-cli.html]=versions/latest/workflow/expo-cli/
redirects[versions/latest/guides/exp-cli]=versions/latest/workflow/expo-cli/
for i in "${!redirects[@]}" # iterate over keys
do
aws s3 cp \
--metadata-directive REPLACE \
--website-redirect "/${redirects[$i]}" \
"$target/404.html" \
"s3://${bucket}/${i}"
done