guarding-deployments

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Guarding Deployments

部署防护

When to use this skill

何时使用该Skill

  • Before pushing to production or staging branches.
  • When the user asks "is it safe to deploy?".
  • To verify environment variables and secrets are present.
  • 推送至生产或staging分支之前。
  • 当用户询问“现在部署安全吗?”时。
  • 用于验证环境变量和密钥是否已配置。

Workflow

工作流程

  1. Preparation
    • Identify target environment (e.g.,
      production
      ,
      staging
      ).
    • List required environment variables.
  2. Verification
    • Run linting and type checks.
    • Execute test suite with
      npm test
      .
    • Verify environment variables using
      scripts/check-env.sh
      .
  3. Execution
    • If all checks pass, proceed with deployment command.
    • If any check fails, block deployment and report errors.
  1. 准备阶段
    • 确定目标环境(例如:
      production
      staging
      )。
    • 列出所需的环境变量。
  2. 验证阶段
    • 运行linting和类型检查。
    • 执行测试套件:
      npm test
    • 使用
      scripts/check-env.sh
      验证环境变量。
  3. 执行阶段
    • 若所有检查通过,继续执行部署命令。
    • 若任何检查失败,阻止部署并报告错误。

Instructions

操作说明

Linting & Tests

Linting & 测试

Ensure the project is in a clean state:
bash
undefined
确保项目处于干净状态:
bash
undefined

Run linting

Run linting

npm run lint
npm run lint

Run unit tests

Run unit tests

npm test
undefined
npm test
undefined

Environment Variable Check

环境变量检查

Use the provided script to ensure required keys are set:
bash
./scripts/check-env.sh .env.production DB_URL API_KEY
使用提供的脚本确保所需密钥已配置:
bash
./scripts/check-env.sh .env.production DB_URL API_KEY

Resources

参考资源

  • check-env.sh
  • Example .env
  • check-env.sh
  • Example .env