|
1 | | -# Hello world javascript action |
| 1 | +# SimpleLocalize GitHub Action |
| 2 | + |
| 3 | +Action installs, configures, and runs the SimpleLocalize CLI with the version, command, and arguments of your choice. |
| 4 | + |
| 5 | +Learn more: https://simplelocalize.io/docs/cli/get-started/ |
2 | 6 |
|
3 | | -This action prints "Hello World" or "Hello" + the name of a person to greet to the log. |
4 | 7 |
|
5 | 8 | ## Inputs |
6 | 9 |
|
7 | | -### `who-to-greet` |
| 10 | +### `api-key` |
| 11 | + |
| 12 | +The API key for SimpleLocalize. Default `""`. |
| 13 | + |
| 14 | +Example: `${{ secrets.SIMPLELOCALIZE_API_KEY }}` |
| 15 | + |
| 16 | +### `command` |
| 17 | + |
| 18 | +**Required** The name of command to run. Default `"status"`. |
8 | 19 |
|
9 | | -**Required** The name of the person to greet. Default `"World"`. |
| 20 | +Example: `upload`, `auto-translate`, `download`, `publish`, `pull` |
10 | 21 |
|
11 | | -## Outputs |
| 22 | +### `cli-version` |
12 | 23 |
|
13 | | -### `time` |
| 24 | +**Required** The version of the SimpleLocalize CLI to use. |
| 25 | +All available versions can be found here: https://github.com/simplelocalize/simplelocalize-cli/releases |
14 | 26 |
|
15 | | -The time we greeted you. |
| 27 | +Example: `2.2.0` |
16 | 28 |
|
17 | | -## Example usage |
| 29 | +### `args` |
18 | 30 |
|
19 | | -```yaml |
20 | | - |
21 | | -with: |
22 | | - who-to-greet: 'Mona the Octocat' |
| 31 | +The arguments for the command. Default `""`. |
| 32 | + |
| 33 | +Example: `--uploadPath ./translations/{lang}.json --uploadFormat single-language-json --dryRun` |
| 34 | + |
| 35 | +# Examples of usage |
| 36 | + |
| 37 | +The workflow below will upload translations, auto-translate them, |
| 38 | +download translations, publish them and pull them to the hosting resources. |
| 39 | + |
| 40 | +```yml |
| 41 | +name: 'My project' |
| 42 | +on: |
| 43 | + push: |
| 44 | + branches: [ main ] |
| 45 | + |
| 46 | +jobs: |
| 47 | + build: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v3 |
| 51 | + - name: Upload translations |
| 52 | + uses: simplelocalize/github-action@v1 |
| 53 | + with: |
| 54 | + api-key: ${{ secrets.SIMPLELOCALIZE_API_KEY }} |
| 55 | + command: 'upload' |
| 56 | + cli-version: '2.2.0' |
| 57 | + args: '--uploadPath ./translations/{lang}.json --uploadFormat single-language-json --dryRun' |
| 58 | + - name: Auto-translate project |
| 59 | + uses: simplelocalize/github-action@v1 |
| 60 | + with: |
| 61 | + api-key: ${{ secrets.SIMPLELOCALIZE_API_KEY }} |
| 62 | + command: 'auto-translate' |
| 63 | + cli-version: '2.2.0' |
| 64 | + - name: Download translations |
| 65 | + uses: simplelocalize/github-action@v1 |
| 66 | + with: |
| 67 | + api-key: ${{ secrets.SIMPLELOCALIZE_API_KEY }} |
| 68 | + command: 'download' |
| 69 | + cli-version: '2.2.0' |
| 70 | + args: '--downloadPath ./translations/{lang}.json --downloadFormat single-language-json' |
| 71 | + - name: Publish translations |
| 72 | + uses: simplelocalize/github-action@v1 |
| 73 | + with: |
| 74 | + api-key: ${{ secrets.SIMPLELOCALIZE_API_KEY }} |
| 75 | + command: 'publish' |
| 76 | + cli-version: '2.2.0' |
| 77 | + args: '--environment latest' |
| 78 | + - name: Pull translations |
| 79 | + uses: simplelocalize/github-action@v1 |
| 80 | + with: |
| 81 | + api-key: ${{ secrets.SIMPLELOCALIZE_API_KEY }} |
| 82 | + command: 'pull' |
| 83 | + cli-version: '2.2.0' |
| 84 | + args: "--pullPath ./translation-hosting-resources/ --environment latest --filterRegex '_index.json'" |
23 | 85 | ``` |
| 86 | +
|
0 commit comments