Skip to content

Commit 61ac8b9

Browse files
feat: v2 release (#225)
1 parent 0f46116 commit 61ac8b9

File tree

7 files changed

+25
-91
lines changed

7 files changed

+25
-91
lines changed

.github/workflows/update-main-version.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
type: choice
1313
description: The main version to update
1414
options:
15+
- v2
1516
- v1
1617

1718
jobs:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM crowdin/cli:3.19.4
1+
FROM crowdin/cli:4.0.0
22

33
RUN apk --no-cache add curl git git-lfs jq gnupg;
44

EXAMPLES.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: actions/checkout@v4
5050

5151
- name: Synchronize with Crowdin
52-
uses: crowdin/github-action@v1
52+
uses: crowdin/github-action@v2
5353
with:
5454
upload_sources: true
5555
upload_translations: true
@@ -83,7 +83,7 @@ jobs:
8383
uses: actions/checkout@v4
8484

8585
- name: Synchronize with Crowdin
86-
uses: crowdin/github-action@v1
86+
uses: crowdin/github-action@v2
8787
with:
8888
upload_sources: true
8989
upload_translations: false
@@ -115,18 +115,20 @@ jobs:
115115
uses: actions/checkout@v4
116116

117117
- name: Crowdin sync
118-
uses: crowdin/github-action@v1
118+
uses: crowdin/github-action@v2
119119
with:
120120
upload_sources: true
121121
upload_translations: false
122122
source: src/locale/en.json # Sources pattern
123123
translation: src/locale/%android_code%.json # Translations pattern
124-
project_id: ${{ secrets.CROWDIN_PROJECT_ID }} # Crowdin Project ID
125-
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} # Crowdin Personal Access Token
126124
env:
127125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
127+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
128128
```
129129
130+
The Action/CLI will automatically detect the [environment variables](https://crowdin.github.io/crowdin-cli/configuration#environment-variables) and use them for the configuration.
131+
130132
> **Note**
131133
> To avoid any conflicts, do not use the `crowdin.yml` file in the repository when using the above configuration approach.
132134

@@ -147,7 +149,7 @@ jobs:
147149
uses: actions/checkout@v4
148150
149151
- name: Crowdin push
150-
uses: crowdin/github-action@v1
152+
uses: crowdin/github-action@v2
151153
with:
152154
upload_sources: true
153155
upload_translations: false
@@ -174,7 +176,7 @@ jobs:
174176
uses: actions/checkout@v4
175177
176178
- name: Crowdin push
177-
uses: crowdin/github-action@v1
179+
uses: crowdin/github-action@v2
178180
with:
179181
upload_sources: true
180182
upload_translations: false
@@ -206,7 +208,7 @@ jobs:
206208
uses: actions/checkout@v4
207209
208210
- name: Crowdin pull
209-
uses: crowdin/github-action@v1
211+
uses: crowdin/github-action@v2
210212
with:
211213
upload_sources: false
212214
upload_translations: false
@@ -241,7 +243,7 @@ jobs:
241243
uses: actions/checkout@v4
242244
243245
- name: Crowdin pull
244-
uses: crowdin/github-action@v1
246+
uses: crowdin/github-action@v2
245247
with:
246248
download_translations: false
247249
download_bundle: 1
@@ -277,7 +279,7 @@ jobs:
277279
uses: actions/checkout@v4
278280
279281
- name: Synchronize with Crowdin
280-
uses: crowdin/github-action@v1
282+
uses: crowdin/github-action@v2
281283
with:
282284
upload_sources: true
283285
upload_translations: true
@@ -307,7 +309,7 @@ By default, the Action looks for the `crowdin.yml` file in the repository root.
307309
# ...
308310
309311
- name: Crowdin
310-
uses: crowdin/github-action@v1
312+
uses: crowdin/github-action@v2
311313
with:
312314
config: '.github/crowdin.yml'
313315
#...
@@ -339,7 +341,7 @@ jobs:
339341
uses: actions/checkout@v4
340342
341343
- name: Matrix
342-
uses: crowdin/github-action@v1
344+
uses: crowdin/github-action@v2
343345
with:
344346
upload_sources: false
345347
upload_translations: false
@@ -383,7 +385,7 @@ jobs:
383385
fetch-depth: 0
384386
385387
- name: Synchronize with Crowdin
386-
uses: crowdin/github-action@v1
388+
uses: crowdin/github-action@v2
387389
with:
388390
upload_sources: true
389391
upload_translations: true
@@ -464,7 +466,7 @@ There is a possibility to get the URL or number of the created Pull Request. You
464466
```yaml
465467
# ...
466468
- name: Crowdin
467-
uses: crowdin/github-action@v1
469+
uses: crowdin/github-action@v2
468470
id: crowdin-download
469471
with:
470472
download_translations: true
@@ -505,7 +507,7 @@ jobs:
505507
uses: actions/checkout@v4
506508
507509
- name: Check translation progress
508-
uses: crowdin/github-action@v1
510+
uses: crowdin/github-action@v2
509511
with:
510512
command: 'status translation'
511513
command_args: '--fail-if-incomplete'
@@ -532,7 +534,7 @@ jobs:
532534
uses: actions/checkout@v4
533535
534536
- name: Pre-translate
535-
uses: crowdin/github-action@v1
537+
uses: crowdin/github-action@v2
536538
with:
537539
command: 'pre-translate'
538540
command_args: '--language uk --method tm'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Crowdin
3+
Copyright (c) Crowdin
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This action allows you to easily integrate and automate the localization of your
3434
- Downloads translations from Crowdin.
3535
- Download sources from Crowdin.
3636
- Creates a PR with the translations.
37-
- Run any Crowdin CLI command.
37+
- Run any [Crowdin CLI](https://crowdin.github.io/crowdin-cli/commands/crowdin) command.
3838

3939
## Usage
4040

@@ -58,7 +58,7 @@ jobs:
5858
uses: actions/checkout@v4
5959

6060
- name: crowdin action
61-
uses: crowdin/github-action@v1
61+
uses: crowdin/github-action@v2
6262
with:
6363
upload_sources: true
6464
upload_translations: false
@@ -168,25 +168,14 @@ You can also run any other Crowdin CLI command by specifying the `command` and `
168168

169169
```yaml
170170
- name: crowdin action
171-
uses: crowdin/github-action@v1
171+
uses: crowdin/github-action@v2
172172
with:
173173
command: 'pre-translate'
174174
command_args: '-l uk --method tm --branch main'
175175
```
176176

177177
To see the full list of available commands, visit the [official documentation](https://crowdin.github.io/crowdin-cli/).
178178

179-
### Crowdin configuration file
180-
181-
If your workflow file specifies the `config` property, you'll need to add the following to your [Crowdin configuration file](https://support.crowdin.com/configuration-file/) (e.g. `crowdin.yml`):
182-
183-
```yml
184-
project_id_env: CROWDIN_PROJECT_ID
185-
api_token_env: CROWDIN_PERSONAL_TOKEN
186-
```
187-
188-
When the workflow runs, the real values of your token and project ID will be injected into the config using the secrets in the environment.
189-
190179
## Outputs
191180

192181
This action has the following outputs:

action.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -123,36 +123,10 @@ inputs:
123123
default: 'false'
124124
required: false
125125

126-
# branch options
127-
add_crowdin_branch:
128-
description: 'Option to create specified version branch in your Crowdin project'
129-
deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.'
130-
required: false
131-
new_branch_title:
132-
description: 'Use to provide more details for translators. Title is available in UI only'
133-
deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.'
134-
required: false
135-
new_branch_export_pattern:
136-
description: 'Branch export pattern. Defines branch name and path in resulting translations bundle'
137-
deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.'
138-
required: false
139-
new_branch_priority:
140-
description: 'Defines priority level for each branch [LOW, NORMAL, HIGH]'
141-
deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.'
142-
required: false
143-
delete_crowdin_branch:
144-
description: 'Option to remove specified version branch in your Crowdin project'
145-
deprecationMessage: 'This option is deprecated. Please use `command: branch delete name` instead.'
146-
required: false
147-
148126
# global options
149127
crowdin_branch_name:
150128
description: 'Option to upload or download files to the specified version branch in your Crowdin project'
151129
required: false
152-
identity:
153-
description: 'Option to specify a path to user-specific credentials, without / at the beginning'
154-
deprecationMessage: 'This option is deprecated. Please use the environment variables instead.'
155-
required: false
156130
config:
157131
description: 'Option to specify a path to the configuration file, without / at the beginning'
158132
required: false

entrypoint.sh

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,6 @@ setup_commit_signing() {
286286
rm private.key
287287
}
288288

289-
get_branch_available_options() {
290-
for OPTION in "$@" ; do
291-
if echo "$OPTION" | egrep -vq "^(--dryrun|--branch|--source|--translation)"; then
292-
AVAILABLE_OPTIONS="${AVAILABLE_OPTIONS} ${OPTION}"
293-
fi
294-
done
295-
296-
echo "$AVAILABLE_OPTIONS"
297-
}
298-
299289
echo "STARTING CROWDIN ACTION"
300290

301291
cd "${GITHUB_WORKSPACE}" || exit 1
@@ -317,10 +307,6 @@ if [ -n "$INPUT_CROWDIN_BRANCH_NAME" ]; then
317307
set -- "$@" --branch="${INPUT_CROWDIN_BRANCH_NAME}"
318308
fi
319309

320-
if [ -n "$INPUT_IDENTITY" ]; then
321-
set -- "$@" --identity="${INPUT_IDENTITY}"
322-
fi
323-
324310
if [ -n "$INPUT_CONFIG" ]; then
325311
set -- "$@" --config="${INPUT_CONFIG}"
326312
fi
@@ -368,18 +354,6 @@ if [ -n "$INPUT_COMMAND" ]; then
368354
exit 0
369355
fi
370356

371-
if [ -n "$INPUT_ADD_CROWDIN_BRANCH" ]; then
372-
NEW_BRANCH_OPTIONS=$( get_branch_available_options "$@" )
373-
374-
if [ -n "$INPUT_NEW_BRANCH_PRIORITY" ]; then
375-
NEW_BRANCH_OPTIONS="${NEW_BRANCH_OPTIONS} --priority=${INPUT_NEW_BRANCH_PRIORITY}"
376-
fi
377-
378-
echo "CREATING BRANCH $INPUT_ADD_CROWDIN_BRANCH"
379-
380-
crowdin branch add "$INPUT_ADD_CROWDIN_BRANCH" $NEW_BRANCH_OPTIONS --title="${INPUT_NEW_BRANCH_TITLE}" --export-pattern="${INPUT_NEW_BRANCH_EXPORT_PATTERN}"
381-
fi
382-
383357
if [ "$INPUT_UPLOAD_SOURCES" = true ]; then
384358
upload_sources "$@"
385359
fi
@@ -425,7 +399,7 @@ fi
425399
if [ "$INPUT_DOWNLOAD_BUNDLE" ]; then
426400
echo "DOWNLOADING BUNDLE $INPUT_DOWNLOAD_BUNDLE"
427401

428-
crowdin download bundle $INPUT_DOWNLOAD_BUNDLE $@
402+
crowdin bundle download $INPUT_DOWNLOAD_BUNDLE $@
429403

430404
if [ "$INPUT_PUSH_TRANSLATIONS" = true ]; then
431405
[ -z "${GITHUB_TOKEN}" ] && {
@@ -440,9 +414,3 @@ if [ "$INPUT_DOWNLOAD_BUNDLE" ]; then
440414
push_to_branch
441415
fi
442416
fi
443-
444-
if [ -n "$INPUT_DELETE_CROWDIN_BRANCH" ]; then
445-
echo "REMOVING BRANCH $INPUT_DELETE_CROWDIN_BRANCH"
446-
447-
crowdin branch delete "$INPUT_DELETE_CROWDIN_BRANCH" $( get_branch_available_options "$@" )
448-
fi

0 commit comments

Comments
 (0)