- index.html: build og:url/og:image/twitter:image from VITE_APP_ORIGIN - .env.production: marco.earth origin + OSM OAuth client ID - .env.development: VITE_APP_ORIGIN for local builds - scripts/sync-kosmos.sh: sync the kosmos deployment branch from master - README: document the two-branch / two-domain deployment
52 lines
1.6 KiB
Bash
Executable File
52 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Sync the `kosmos` deployment branch from `master` and rebuild its release.
|
|
#
|
|
# Marco is deployed to two domains from two branches, both serving the committed
|
|
# `release/` directory via 5apps Deploy:
|
|
#
|
|
# master -> https://marco.earth (git push 5apps master)
|
|
# kosmos -> https://marco.kosmos.org (git push 5apps-old kosmos:master)
|
|
#
|
|
# The only intentional source difference between the branches is
|
|
# `.env.production` (app origin + OSM OAuth client ID). `release/` is a build
|
|
# artifact committed to each branch, so it must be regenerated for the kosmos
|
|
# domain after every merge from master.
|
|
#
|
|
# Usage: ./scripts/sync-kosmos.sh
|
|
#
|
|
set -e
|
|
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
echo "Working tree is not clean. Commit or stash your changes first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
git checkout kosmos
|
|
git merge --no-commit --no-ff master || true
|
|
|
|
# Any conflict outside of the two expected paths is unexpected and should be
|
|
# resolved by hand.
|
|
conflicts=$(git diff --name-only --diff-filter=U | grep -vE '^(release/|\.env\.production$)' || true)
|
|
if [ -n "$conflicts" ]; then
|
|
echo "Unresolved conflicts outside release/ and .env.production:" >&2
|
|
echo "$conflicts" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Keep the kosmos domain config instead of the one coming from master.
|
|
git checkout HEAD -- .env.production
|
|
|
|
# Rebuild the release from scratch for the kosmos domain.
|
|
rm -rf release
|
|
pnpm build
|
|
git add -A release .env.production
|
|
|
|
if [ -f "$(git rev-parse --git-path MERGE_HEAD)" ]; then
|
|
git commit --no-edit
|
|
elif ! git diff --cached --quiet; then
|
|
git commit -m "Sync kosmos release"
|
|
else
|
|
echo "Already up to date."
|
|
fi
|