2024-02-03 06:04:34 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This script is run by the Cloudflare Pages integration when deploying the apps
|
|
|
|
# in this repository. The app to build is decided based on the the value of the
|
|
|
|
# CF_PAGES_BRANCH environment variable.
|
|
|
|
#
|
|
|
|
# Ref: https://developers.cloudflare.com/pages/how-to/build-commands-branches/
|
2024-02-03 10:24:45 +00:00
|
|
|
#
|
|
|
|
# The CF Pages configuration is set to use `out/` as the build output directory,
|
2024-02-03 11:19:50 +00:00
|
|
|
# so once we're done building we copy the app specific output to `out/`.
|
2024-02-03 06:04:34 +00:00
|
|
|
|
|
|
|
set -o errexit
|
2024-02-03 11:03:51 +00:00
|
|
|
set -o xtrace
|
2024-02-03 06:04:34 +00:00
|
|
|
|
2024-02-03 11:19:50 +00:00
|
|
|
rm -rf out
|
|
|
|
|
2024-02-03 11:03:51 +00:00
|
|
|
if test "$CF_PAGES_BRANCH" = "auth-release"
|
2024-02-03 06:04:34 +00:00
|
|
|
then
|
2024-02-09 12:24:26 +00:00
|
|
|
# By default, for preview deployments the NEXT_PUBLIC_APP_ENV is set to
|
|
|
|
# "test" in the CF environment variables. For production deployments of the
|
|
|
|
# auth app, reset this to "production".
|
|
|
|
#
|
|
|
|
# This is not needed for the default `yarn export:photos` case, because
|
|
|
|
# there the actual production deployment runs without NEXT_PUBLIC_APP_ENV
|
|
|
|
# being set to anything (and the other preview deployments have
|
|
|
|
# NEXT_PUBLIC_APP_ENV set to "test", as is correct).
|
|
|
|
export NEXT_PUBLIC_APP_ENV=production
|
2024-02-03 06:04:34 +00:00
|
|
|
yarn export:auth
|
2024-02-03 11:19:50 +00:00
|
|
|
cp -R apps/auth/out .
|
2024-02-03 06:04:34 +00:00
|
|
|
else
|
|
|
|
yarn export:photos
|
2024-02-03 11:42:25 +00:00
|
|
|
cp -R apps/photos/out .
|
2024-02-03 06:04:34 +00:00
|
|
|
fi
|