Jordach MakayaOperations leader · Backend & systems engineeringCasablanca · FR / EN
All tools
Labs · Developer toolOpen source projectCLIGitHub ActionsGitLab CI/CD

Your .env. Your CI. In sync.

Stop copying environment variables into CI/CD dashboards by hand.

Package
@hardmachinelabs/env-sync
Reading
8 min
Status
Published on npm
Requires
Node.js ≥ 20
Real run · six secrets synced to GitHub ActionsView full size ↗
Local files
.envDATABASE_URL
packages/blog/.envRESEND_API_KEY
env-syncdeterministic mapping · --dry-run first
DATABASE_URL
BLOG_RESEND_API_KEY
CI/CD stores
GitHub ActionsRepository secrets
GitLab CI/CDProject variables
From .env layout to namespaced CI secretspreview → review → sync

The problem

A common deployment problem looks simple: local .env changes, developer updates application code, CI/CD still holds outdated secret values, and deployments fail or silently leak errors.

Local .env changes → Developer pushes → CI/CD holds old secrets → Deployment fails

Installation & dry-run

Install as a development dependency:

pnpm add -D @hardmachinelabs/env-sync

Always start with a dry run to inspect the planned mutations:

env-sync --provider=github --env=production --dry-run

Monorepo-aware secret names

In multi-package workspaces, env-sync automatically namespaces secrets based on package directory structure:

  • Root: DATABASE_URL → DATABASE_URL
  • packages/blog/.env: RESEND_API_KEY → BLOG_RESEND_API_KEY

Safety model

env-sync synchronizes variables discovered in local .env files into CI targets; it does not manage remote secret deletion or act as an organization-wide secrets manager. Every sync supports a non-destructive dry-run (--dry-run) to inspect discovered keys and planned mutations before writing. Line-based workflow diffs should always be reviewed before committing.

Useful commands

GitHub — Preview
env-sync --provider=github --env=production --dry-run
GitHub — Sync
env-sync --provider=github --env=production
GitLab — Preview
env-sync --provider=gitlab --env=production --dry-run
GitLab — Sync
env-sync --provider=gitlab --env=production