From 7f6967d658c8807815873a819ec509af919f30e3 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 10 Jun 2022 20:06:37 +0800 Subject: [PATCH 1/4] Add default github action copied from the https://github.com/crowdin/github-action --- .github/workflows/crowdin.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/crowdin.yml diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml new file mode 100644 index 000000000..fe3b66217 --- /dev/null +++ b/.github/workflows/crowdin.yml @@ -0,0 +1,24 @@ +name: Crowdin Action + +on: + push: + branches: [ master ] + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - name: crowdin action + uses: crowdin/github-action@1.4.9 + with: + upload_translations: true + download_translations: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} From eea8b924f116243b35c5d9b0983d06e9404af0e0 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 10 Jun 2022 20:10:02 +0800 Subject: [PATCH 2/4] This CI should works only if file in the localisation folder changed. --- .github/workflows/crowdin.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index fe3b66217..45fda28bd 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -3,6 +3,8 @@ name: Crowdin Action on: push: branches: [ master ] + paths: + - 'osu.Game.Rulesets.Karaoke/Localisation/**' jobs: synchronize-with-crowdin: From 925c7b93d2bfb139aa048037d42ab72a99105b58 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 10 Jun 2022 20:22:14 +0800 Subject: [PATCH 3/4] Add the action to generate the localisation file. --- .github/workflows/crowdin.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index 45fda28bd..20e11fe3f 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -7,6 +7,20 @@ on: - 'osu.Game.Rulesets.Karaoke/Localisation/**' jobs: + generate-localization-file: + name: Generate the localization file + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install dependencies + run: dotnet restore + - name: Install the localization tools. + run: dotnet tool restore + - name: Generate the localization file + run: dotnet localisation to-resx ./osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj --output ${{github.workspace}}\crowdin + synchronize-with-crowdin: runs-on: ubuntu-latest From 22c733bab0bc59c9eaf086877922ff868f05db73 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 10 Jun 2022 20:23:21 +0800 Subject: [PATCH 4/4] Add the source setting to get the localization file. And notice that there's no need to checkout the repo. Just need to upload the file. --- .github/workflows/crowdin.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index 20e11fe3f..17ee12b8e 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -22,18 +22,17 @@ jobs: run: dotnet localisation to-resx ./osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj --output ${{github.workspace}}\crowdin synchronize-with-crowdin: + name: Upload the localization into crowdin runs-on: ubuntu-latest - + needs: [generate-localization-file] steps: - - - name: Checkout - uses: actions/checkout@v2 - - name: crowdin action uses: crowdin/github-action@1.4.9 with: upload_translations: true - download_translations: true + download_translations: false + source: ${{github.workspace}}\crowdin\*.resx + translation: ${{github.workspace}}\crowdin\%file_name%.%locale%.%file_extension% env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}