Read CI env from Infisical and give the local stack its own ports
Build and Push Next App / quality (push) Successful in 1m12s
Build and Push Next App / build-next (push) Successful in 2m20s

CI reads Infisical staging as the read-only convexmonorepo-base-ci machine identity, runs the quality gate, and builds and pushes the image. The template is not deployed, so there is no Convex or VPS deploy step. The local stack moves to its own Compose name and ports so it runs beside the Payload template's, and it syncs the Convex runtime env. The scripts pick up Infisical account switching, dev-kill and a cache-safe CI install.
This commit is contained in:
Gabriel Brown committed 2026-10-01 14:55:35 -04:00
1 parent 55b253257b
commit 8f09a423d4
18 files changed
+452 -55

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)"
VALUE_FILE=""
readonly RUNTIME_ENV_NAMES=(
AUTH_AUTHENTIK_ID
AUTH_AUTHENTIK_SECRET
AUTH_AUTHENTIK_ISSUER
USESEND_API_KEY
USESEND_URL
USESEND_FROM_EMAIL
)
readonly DEPLOYMENT_ENV_NAMES=(
CONVEX_SELF_HOSTED_URL
CONVEX_SELF_HOSTED_ADMIN_KEY
)
die() { printf 'sync-local-convex-env: %s\n' "$*" >&2; exit 1; }
cleanup() {
if [ -n "$VALUE_FILE" ] && [ -f "$VALUE_FILE" ]; then
rm -f "$VALUE_FILE"
fi
}
trap cleanup EXIT INT TERM HUP
for name in "${DEPLOYMENT_ENV_NAMES[@]}" "${RUNTIME_ENV_NAMES[@]}"; do
[ -n "${!name:-}" ] || die "Missing required environment variable: $name"
done
VALUE_FILE="$(mktemp "${TMPDIR:-/tmp}/convex-monorepo-convex-env.value.XXXXXX")"
chmod 600 "$VALUE_FILE"
for name in "${RUNTIME_ENV_NAMES[@]}"; do
printf '%s' "${!name}" > "$VALUE_FILE"
(
cd "$ROOT_DIR/packages/backend"
env -u CONVEX_DEPLOY_KEY -u CONVEX_DEPLOYMENT \
CONVEX_SELF_HOSTED_URL="$CONVEX_SELF_HOSTED_URL" \
CONVEX_SELF_HOSTED_ADMIN_KEY="$CONVEX_SELF_HOSTED_ADMIN_KEY" \
bunx convex env set "$name" --from-file "$VALUE_FILE" >/dev/null
)
done
printf 'Local Convex runtime environment synchronized.\n'