Created
January 25, 2026 01:04
-
-
Save fayimora/7163cc4e2e3c65951245721e9e8c4b88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Get repo info | |
| REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner) | |
| echo "Setting up GitHub Environments for $REPO" | |
| # Create environments | |
| echo "Creating environments..." | |
| gh api "repos/$REPO/environments/production" -X PUT | |
| gh api "repos/$REPO/environments/staging" -X PUT | |
| # Production variables | |
| echo "Setting production variables..." | |
| gh variable set VITE_CONVEX_URL --env production --body "${PROD_VITE_CONVEX_URL:?Required}" | |
| gh variable set VITE_CONVEX_SITE_URL --env production --body "${PROD_VITE_CONVEX_SITE_URL:?Required}" | |
| gh variable set VITE_SITE_URL --env production --body "${PROD_VITE_SITE_URL:?Required}" | |
| gh variable set VITE_POSTHOG_KEY --env production --body "${PROD_VITE_POSTHOG_KEY:?Required}" | |
| gh variable set VITE_POSTHOG_HOST --env production --body "${PROD_VITE_POSTHOG_HOST:-https://eu.i.posthog.com}" | |
| # Production secrets | |
| echo "Setting production secrets..." | |
| gh secret set CONVEX_DEPLOY_KEY --env production --body "${PROD_CONVEX_DEPLOY_KEY:?Required}" | |
| # Staging variables | |
| echo "Setting staging variables..." | |
| gh variable set VITE_CONVEX_URL --env staging --body "${STAGING_VITE_CONVEX_URL:?Required}" | |
| gh variable set VITE_CONVEX_SITE_URL --env staging --body "${STAGING_VITE_CONVEX_SITE_URL:?Required}" | |
| gh variable set VITE_SITE_URL --env staging --body "${STAGING_VITE_SITE_URL:?Required}" | |
| gh variable set VITE_POSTHOG_KEY --env staging --body "${STAGING_VITE_POSTHOG_KEY:?Required}" | |
| gh variable set VITE_POSTHOG_HOST --env staging --body "${STAGING_VITE_POSTHOG_HOST:?Required}" | |
| # gh variable set VITE_POSTHOG_HOST --env staging --body "${STAGING_VITE_POSTHOG_HOST:-https://eu.i.posthog.com}" | |
| # Staging secrets | |
| echo "Setting staging secrets..." | |
| gh secret set CONVEX_DEPLOY_KEY --env staging --body "${STAGING_CONVEX_DEPLOY_KEY:?Required}" | |
| echo "Done! Environments configured." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment