cli
wx in CI pipelines
Send source files to wxrks from a build pipeline, with the API user's credentials kept in the pipeline's secrets.
Credentials
Store the access key and secret as secrets of the pipeline and expose them as BW_ACCESS_KEY and BW_SECRET. Set BW_HOST when your workspace is not on app.wxrks.com. wx needs no config file then (see Configure wx).
Send files
wx ci upload-file sends a file to the continuous project of an org unit and a CI tag. It creates the project, the file and its work units when they do not exist yet, and adds target languages that are new.
wx ci upload-file <orgUnitUUID> my-app-strings --file ./locales/en.json --path locales --locale pt_br --locale de_de
It calls Upload Continuous Project File. Projects from files (CI API) explains continuous projects, CI tags and each field.
Get the translations
- Find the project with
wx ci get <orgUnitUUID> my-app-strings. - Request its translated files with
wx project request-download-translated-files <projectUUID> --body @request.json(Request Project Translated Files). - Run
wx project download-translated-files <projectUUID> <translationKitJobUUID>until the job isCOMPLETED, then download itsdownloadFileUrl.
To learn when files are ready without polling, subscribe to WORK_UNIT_TRANSLATION_FILE_READY (see Webhooks).
GitHub Actions
name: Translations
on:
push:
branches: [main]
paths: ['locales/en.json']
jobs:
send-strings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install wx
run: |
curl -sL https://github.com/wxrks-hq/wx/releases/download/v0.3.1/wx_Linux_x86_64.tar.gz | tar xz wx
sudo mv wx /usr/local/bin/
- name: Send source strings
env:
BW_ACCESS_KEY: ${{ secrets.WXRKS_ACCESS_KEY }}
BW_SECRET: ${{ secrets.WXRKS_SECRET }}
run: wx ci upload-file "${{ vars.WXRKS_ORG_UNIT }}" my-app-strings --file locales/en.json --path locales
The download URL names a release, so the pipeline keeps the same wx until you change it. releases/latest/download/ always takes the newest.