CI/CD Integration
Automate translation exports in your CI/CD pipeline for consistent, up-to-date translations in every deployment.
GitHub Actions
.github/workflows/deploy.yml
name: Build and Deploy
on:
push:
branches: [main]
schedule:
- cron: '0 0 * * *' # Daily at midnight
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install LangCTL CLI
run: npm install -g @langctl/cli
- name: Export Translations
env:
LANGCTL_API_KEY: ${{ secrets.LANGCTL_API_KEY }}
run: |
langctl export my-app -l en -f i18next -o ./locales/en.json
langctl export my-app -l es -f i18next -o ./locales/es.json
langctl export my-app -l fr -f i18next -o ./locales/fr.json
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Deploy
run: npm run deploy .gitlab-ci.yml
export_and_deploy:
image: node:18
before_script:
- npm install -g @langctl/cli
script:
- langctl export my-app --all-languages -f i18next -o ./locales
- npm ci
- npm run build
- npm run deploy
variables:
LANGCTL_API_KEY: $LANGCTL_API_KEY
only:
- main .circleci/config.yml
version: 2.1
jobs:
build_and_deploy:
docker:
- image: cimg/node:18.0
steps:
- checkout
- run:
name: Install LangCTL
command: npm install -g @langctl/cli
- run:
name: Export Translations
command: |
langctl export my-app -l en -f i18next -o ./locales/en.json
langctl export my-app -l es -f i18next -o ./locales/es.json
- run:
name: Build
command: |
npm ci
npm run build
- run:
name: Deploy
command: npm run deploy
workflows:
version: 2
build_deploy:
jobs:
- build_and_deploy Never commit API keys to git. Use CI/CD secrets:
- GitHub: Repository Settings > Secrets
- GitLab: Settings > CI/CD > Variables
- CircleCI: Project Settings > Environment Variables
Add translation export to your build process:
{
"scripts": {
"prebuild": "langctl export my-app --all-languages -o ./locales",
"build": "vite build"
}
} Improve build times by caching exports:
- uses: actions/cache@v3
with:
path: ./locales
key: translations-${{ hashFiles('**/package-lock.json') }} Update translations daily without manual deploys:
on:
schedule:
- cron: '0 2 * * *' # 2 AM daily 💡
Tip
Scheduled workflows can keep translations updated without manual intervention. Ideal for continuous localization.
Next Steps
- Version Control Integration - Git workflows
- CLI Export - Export command reference
- Platform Integrations - Platform guides