1#!/usr/bin/env bash 2 3set -euo pipefail 4 5scriptdir=$(dirname "${BASH_SOURCE[0]}") 6bucket="docs.expo.io" 7 8aws s3 sync "${scriptdir}/out" "s3://${bucket}" --delete 9 10aws s3 cp \ 11 --recursive \ 12 --metadata-directive REPLACE \ 13 --cache-control "public,max-age=31536000,immutable" \ 14 "s3://${bucket}/_next/static/" \ 15 "s3://${bucket}/_next/static/" 16 17declare -A redirects # associative array variable 18 19# usage: 20# redicts[requests/for/this/path]=are/redirected/to/this/one 21 22# Temporarily create a redirect for a page that Home links to 23redirects[versions/latest/introduction/installation.html]=versions/latest/introduction/installation/ 24# useful link on twitter 25redirects[versions/latest/guides/app-stores.html]=versions/latest/distribution/app-stores/ 26# Xdl caches 27redirects[versions/latest/guides/offline-support.html]=versions/latest/guides/offline-support/ 28# xdl convert comment 29redirects[versions/latest/sdk/]=versions/latest/sdk/overview/ 30 31for i in "${!redirects[@]}" # iterate over keys 32do 33 aws s3 cp \ 34 --metadata-directive REPLACE \ 35 --website-redirect "/${redirects[$i]}" \ 36 "${scriptdir}/out/404.html" \ 37 "s3://${bucket}/${i}" 38done 39