diff --git a/.github/workflows/update-main-version.yml b/.github/workflows/update-main-version.yml index 5a948d9..01d337f 100644 --- a/.github/workflows/update-main-version.yml +++ b/.github/workflows/update-main-version.yml @@ -12,6 +12,7 @@ on: type: choice description: The main version to update options: + - v2 - v1 jobs: diff --git a/Dockerfile b/Dockerfile index 65c641c..df3e278 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM crowdin/cli:3.19.4 +FROM crowdin/cli:4.0.0 RUN apk --no-cache add curl git git-lfs jq gnupg; diff --git a/EXAMPLES.md b/EXAMPLES.md index 54a8899..42aafe4 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@v4 - name: Synchronize with Crowdin - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: true @@ -83,7 +83,7 @@ jobs: uses: actions/checkout@v4 - name: Synchronize with Crowdin - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: false @@ -115,18 +115,20 @@ jobs: uses: actions/checkout@v4 - name: Crowdin sync - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: false source: src/locale/en.json # Sources pattern translation: src/locale/%android_code%.json # Translations pattern - project_id: ${{ secrets.CROWDIN_PROJECT_ID }} # Crowdin Project ID - token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} # Crowdin Personal Access Token env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} ``` +The Action/CLI will automatically detect the [environment variables](https://crowdin.github.io/crowdin-cli/configuration#environment-variables) and use them for the configuration. + > **Note** > To avoid any conflicts, do not use the `crowdin.yml` file in the repository when using the above configuration approach. @@ -147,7 +149,7 @@ jobs: uses: actions/checkout@v4 - name: Crowdin push - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: false @@ -174,7 +176,7 @@ jobs: uses: actions/checkout@v4 - name: Crowdin push - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: false @@ -206,7 +208,7 @@ jobs: uses: actions/checkout@v4 - name: Crowdin pull - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: false upload_translations: false @@ -241,7 +243,7 @@ jobs: uses: actions/checkout@v4 - name: Crowdin pull - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: download_translations: false download_bundle: 1 @@ -277,7 +279,7 @@ jobs: uses: actions/checkout@v4 - name: Synchronize with Crowdin - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: true @@ -307,7 +309,7 @@ By default, the Action looks for the `crowdin.yml` file in the repository root. # ... - name: Crowdin - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: config: '.github/crowdin.yml' #... @@ -339,7 +341,7 @@ jobs: uses: actions/checkout@v4 - name: Matrix - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: false upload_translations: false @@ -383,7 +385,7 @@ jobs: fetch-depth: 0 - name: Synchronize with Crowdin - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: true @@ -464,7 +466,7 @@ There is a possibility to get the URL or number of the created Pull Request. You ```yaml # ... - name: Crowdin - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 id: crowdin-download with: download_translations: true @@ -505,7 +507,7 @@ jobs: uses: actions/checkout@v4 - name: Check translation progress - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: command: 'status translation' command_args: '--fail-if-incomplete' @@ -532,7 +534,7 @@ jobs: uses: actions/checkout@v4 - name: Pre-translate - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: command: 'pre-translate' command_args: '--language uk --method tm' diff --git a/LICENSE b/LICENSE index 5b73da9..c4d9da8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Crowdin +Copyright (c) Crowdin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 6c5f2ff..3cd1579 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This action allows you to easily integrate and automate the localization of your - Downloads translations from Crowdin. - Download sources from Crowdin. - Creates a PR with the translations. -- Run any Crowdin CLI command. +- Run any [Crowdin CLI](https://crowdin.github.io/crowdin-cli/commands/crowdin) command. ## Usage @@ -58,7 +58,7 @@ jobs: uses: actions/checkout@v4 - name: crowdin action - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: upload_sources: true upload_translations: false @@ -168,7 +168,7 @@ You can also run any other Crowdin CLI command by specifying the `command` and ` ```yaml - name: crowdin action - uses: crowdin/github-action@v1 + uses: crowdin/github-action@v2 with: command: 'pre-translate' command_args: '-l uk --method tm --branch main' @@ -176,17 +176,6 @@ You can also run any other Crowdin CLI command by specifying the `command` and ` To see the full list of available commands, visit the [official documentation](https://crowdin.github.io/crowdin-cli/). -### Crowdin configuration file - -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`): - -```yml -project_id_env: CROWDIN_PROJECT_ID -api_token_env: CROWDIN_PERSONAL_TOKEN -``` - -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. - ## Outputs This action has the following outputs: diff --git a/action.yml b/action.yml index 57a0eb0..6befdd7 100644 --- a/action.yml +++ b/action.yml @@ -123,36 +123,10 @@ inputs: default: 'false' required: false - # branch options - add_crowdin_branch: - description: 'Option to create specified version branch in your Crowdin project' - deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.' - required: false - new_branch_title: - description: 'Use to provide more details for translators. Title is available in UI only' - deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.' - required: false - new_branch_export_pattern: - description: 'Branch export pattern. Defines branch name and path in resulting translations bundle' - deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.' - required: false - new_branch_priority: - description: 'Defines priority level for each branch [LOW, NORMAL, HIGH]' - deprecationMessage: 'This option is deprecated. Please use `command: branch add name` instead.' - required: false - delete_crowdin_branch: - description: 'Option to remove specified version branch in your Crowdin project' - deprecationMessage: 'This option is deprecated. Please use `command: branch delete name` instead.' - required: false - # global options crowdin_branch_name: description: 'Option to upload or download files to the specified version branch in your Crowdin project' required: false - identity: - description: 'Option to specify a path to user-specific credentials, without / at the beginning' - deprecationMessage: 'This option is deprecated. Please use the environment variables instead.' - required: false config: description: 'Option to specify a path to the configuration file, without / at the beginning' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 90a76be..588b6e1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -286,16 +286,6 @@ setup_commit_signing() { rm private.key } -get_branch_available_options() { - for OPTION in "$@" ; do - if echo "$OPTION" | egrep -vq "^(--dryrun|--branch|--source|--translation)"; then - AVAILABLE_OPTIONS="${AVAILABLE_OPTIONS} ${OPTION}" - fi - done - - echo "$AVAILABLE_OPTIONS" -} - echo "STARTING CROWDIN ACTION" cd "${GITHUB_WORKSPACE}" || exit 1 @@ -317,10 +307,6 @@ if [ -n "$INPUT_CROWDIN_BRANCH_NAME" ]; then set -- "$@" --branch="${INPUT_CROWDIN_BRANCH_NAME}" fi -if [ -n "$INPUT_IDENTITY" ]; then - set -- "$@" --identity="${INPUT_IDENTITY}" -fi - if [ -n "$INPUT_CONFIG" ]; then set -- "$@" --config="${INPUT_CONFIG}" fi @@ -368,18 +354,6 @@ if [ -n "$INPUT_COMMAND" ]; then exit 0 fi -if [ -n "$INPUT_ADD_CROWDIN_BRANCH" ]; then - NEW_BRANCH_OPTIONS=$( get_branch_available_options "$@" ) - - if [ -n "$INPUT_NEW_BRANCH_PRIORITY" ]; then - NEW_BRANCH_OPTIONS="${NEW_BRANCH_OPTIONS} --priority=${INPUT_NEW_BRANCH_PRIORITY}" - fi - - echo "CREATING BRANCH $INPUT_ADD_CROWDIN_BRANCH" - - crowdin branch add "$INPUT_ADD_CROWDIN_BRANCH" $NEW_BRANCH_OPTIONS --title="${INPUT_NEW_BRANCH_TITLE}" --export-pattern="${INPUT_NEW_BRANCH_EXPORT_PATTERN}" -fi - if [ "$INPUT_UPLOAD_SOURCES" = true ]; then upload_sources "$@" fi @@ -425,7 +399,7 @@ fi if [ "$INPUT_DOWNLOAD_BUNDLE" ]; then echo "DOWNLOADING BUNDLE $INPUT_DOWNLOAD_BUNDLE" - crowdin download bundle $INPUT_DOWNLOAD_BUNDLE $@ + crowdin bundle download $INPUT_DOWNLOAD_BUNDLE $@ if [ "$INPUT_PUSH_TRANSLATIONS" = true ]; then [ -z "${GITHUB_TOKEN}" ] && { @@ -440,9 +414,3 @@ if [ "$INPUT_DOWNLOAD_BUNDLE" ]; then push_to_branch fi fi - -if [ -n "$INPUT_DELETE_CROWDIN_BRANCH" ]; then - echo "REMOVING BRANCH $INPUT_DELETE_CROWDIN_BRANCH" - - crowdin branch delete "$INPUT_DELETE_CROWDIN_BRANCH" $( get_branch_available_options "$@" ) -fi