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:
- Get your API key from the Replexica dashboard;
- 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:
- It catches translation issues before they hit production;
- It ensures your team never deploys with missing translations;
- It keeps your localization process tight and automated.
How to use --frozen
Add this command to your CI/CD pipeline:
npx replexica@latest i18n --frozen
That's it, you're all set!
What happens when you run it
- Replexica checks your source files;
- It compares them with your current translations;
- If everything's in sync, the command exits successfully;
- If there are missing or outdated translations, it fails with an error.
Example CI/CD setup
Here's a basic example for GitHub Actions:
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
- Run Replexica with
--frozen
before your build step, this catches issues early; - If the check fails, run
npx replexica@latest i18n
locally to update translations; - 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.