Skip to content

CI/CD

This guide shows you how to use Replexica in your CI/CD pipeline to ensure your team never deploys with missing or outdated translations.

Authentication in CI/CD

In your CI/CD environment, Replexica needs to authenticate. It's simple:

  1. Get your API key from the Replexica dashboard;
  2. Set it as an environment variable named REPLEXICA_API_KEY in your CI/CD settings.

The --frozen flag: Your CI/CD best friend

The --frozen flag is a powerful tool for CI/CD. It checks if your translations are up-to-date without making any changes. And, if there are missing or outdated translations, it fails the build.

Here's why it's crucial:

  1. It catches translation issues before they hit production;
  2. It ensures your team never deploys with missing translations;
  3. It keeps your localization process tight and automated.

How to use --frozen

Add this command to your CI/CD pipeline:

bash
npx replexica@latest i18n --frozen

That's it, you're all set!

What happens when you run it

  1. Replexica checks your source files;
  2. It compares them with your current translations;
  3. If everything's in sync, the command exits successfully;
  4. If there are missing or outdated translations, it fails with an error.

Example CI/CD setup

Here's a basic example for GitHub Actions:

yaml
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '20'
      - run: npm ci
      - run: npx replexica@latest i18n --frozen
      - run: npm run build
      - run: npm run deploy

This job will fail if your translations aren't up-to-date, stopping the deployment.

Tips

  1. Run Replexica with --frozen before your build step, this catches issues early;
  2. If the check fails, run npx replexica@latest i18n locally to update translations;
  3. Always commit the i18n.lock file, as it's crucial for tracking changes.

By using --frozen in your CI/CD, you're ensuring your app is always deployed with complete, up-to-date translations. It's a simple step that can save you from localization headaches down the line.