CI pipelines
Two jobs keep AirGlot and your code in step:
- Sync the template on every push to your main branch, so new strings reach translators straight away.
- Pull the latest release before each release build, so the build ships the newest translations.
The app's settings in AirGlot, under Integrations › CI snippet, show these workflows with your own paths filled in. The examples below use the default paths.
Each job needs the AIRGLOT_TOKEN secret. See Tokens.
Flutter
Sync on push (GitHub Actions)
Save as .github/workflows/airglot-sync.yml:
name: airglot-sync
on:
push:
branches: [main]
paths: ["lib/l10n/app_en.arb"]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
- run: dart pub global activate airglot
- name: Sync template to Airglot
env:
AIRGLOT_TOKEN: ${{ secrets.AIRGLOT_TOKEN }}
run: airglot sync
Pull in Flutter release builds
Run before flutter build, with a token that has the Export scope:
dart pub global activate airglot
airglot pull
flutter gen-l10n
Web
Sync on push, check on pull requests (GitHub Actions)
Save as .github/workflows/airglot-sync.yml. Pull requests run check; pushes to main run sync:
name: airglot-sync
on:
push:
branches: [main]
paths: ["messages/en.json", "messages/en.meta.json"]
pull_request:
paths: ["messages/en.json", "messages/en.meta.json"]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Check the template and descriptions
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
env:
AIRGLOT_TOKEN: ${{ secrets.AIRGLOT_TOKEN }}
run: npx @airglot/cli check
- name: Sync template to Airglot
if: github.event_name == 'push'
env:
AIRGLOT_TOKEN: ${{ secrets.AIRGLOT_TOKEN }}
run: npx @airglot/cli sync
The check step skips pull requests from forks, which can't read your secrets.
Sync on push (Bitbucket Pipelines)
Add to bitbucket-pipelines.yml, and store the token as a secured repository variable named AIRGLOT_TOKEN:
pipelines:
branches:
main:
- step:
name: Sync template to Airglot
image: node:20
condition:
changesets:
includePaths:
- "messages/en.json"
- "messages/en.meta.json"
script:
- npx @airglot/cli sync
Pull in web release builds
Run before the build, with a token that has the Export scope:
npx @airglot/cli pull
npx @airglot/cli check
npm run build
Other CI systems
Any CI that can run Dart or Node works. Set AIRGLOT_TOKEN, then run the same commands. sync records the commit it ran on from GITHUB_SHA, BITBUCKET_COMMIT or CI_COMMIT_SHA. On other systems, pass it with --commit <sha>.
Fail the build on untranslated strings
check warns about strings that aren't in a release yet. To fail store or production release jobs instead, set missing: fail in airglot.yaml, or pass --missing fail to check for one run.
Commit the lock file
pull records the release it wrote in airglot.lock. Commit it with the pulled files so every commit says which release it was built with.