A GitHub Actions workflow syncs secrets from GitHub to Vercel project environment variables via the Vercel API, then triggers a deployment via Deploy Hook. No secrets are stored in the repo; Vercel builds consume the synced env vars.
.github/workflows/sync-secrets-to-vercel.yml– Runs onworkflow_dispatch(manual) or push tomain. ReadsGOOGLE_OAUTH_CLIENT_IDfrom GitHub Secrets, upserts it into your Vercel project env (production, preview, development), then triggers a deployment.api/check-env.js– Vercel serverless function that returns whetherGOOGLE_OAUTH_CLIENT_IDis set (value never exposed).index.html– Simple page that calls/api/check-envand shows the result.
- Push this folder to a GitHub repo, then import it in Vercel as a new project.
- Or run
vercelin this folder and link the project. Note the project name.
Vercel Dashboard → Account Settings → Tokens → Create Token. Copy the value.
Vercel Dashboard → Project → Settings → Git → Deploy Hooks → create a hook (branch: main). Copy the URL.
Repo → Settings → Secrets and variables → Actions:
| Secret name | Value |
|---|---|
VERCEL_TOKEN |
Your Vercel API token |
VERCEL_DEPLOY_HOOK_URL |
Your Vercel Deploy Hook URL |
GOOGLE_OAUTH_CLIENT_ID |
A test value (e.g. test-client-id-123) |
Optional (team projects only): add VERCEL_TEAM_ID (Team Settings → General → Team ID).
Set the repo variable VERCEL_PROJECT_NAME (Settings → Variables) to your Vercel project name, or edit the default in the workflow file directly.
If you use a Vercel team, uncomment the teamId line in the workflow and set VERCEL_TEAM_ID in GitHub Secrets.
- Trigger the workflow — Actions → Sync secrets to Vercel → Run workflow (or push to
main). - The workflow syncs the env var to Vercel, then automatically triggers a deployment via Deploy Hook.
- Verify — open your deployment URL; the page calls
/api/check-envand shows whetherGOOGLE_OAUTH_CLIENT_IDis set.
- The real secret value lives only in GitHub Secrets.
- The workflow calls
POST /v10/projects/{name}/env?upsert=trueon the Vercel API to push the value. - Vercel stores it as an encrypted project env var.
- The workflow triggers a deployment via Deploy Hook — the build runs with the freshly synced env var.
Copy the workflow into your main app's repo. Add a pre-build script that reads process.env.GOOGLE_OAUTH_CLIENT_ID and writes it into environment.*.ts before ng build runs. The Vercel build will then have the synced value baked into the Angular environment file.