-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to GitHub Actions for Crowdin sync
- Loading branch information
Showing
3 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Crowdin - Download Translations | ||
|
||
on: | ||
# Scheduled run once a day | ||
schedule: | ||
- cron: '0 2 * * *' | ||
# Run after: | ||
# - "Upload Base" workflow completes | ||
workflow_run: | ||
workflows: ["Crowdin - Upload Sources"] | ||
types: | ||
- completed | ||
# Support running manually | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-master | ||
|
||
jobs: | ||
crowdin-download-translations: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
environment: crowdin_sync | ||
steps: | ||
# Get a token using a GitHub App that has appropriate permissions *and* will trigger subsequent CI workflows | ||
# (Since we want to run normal CI passes to catch translation string format errors that break builds) | ||
- name: Get GH App Token | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.WZ_CROWDIN_SYNC_GH_APP_ID }} | ||
private-key: ${{ secrets.WZ_CROWDIN_SYNC_GH_APP_PRIVATE_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
repositories: "warzone2100" | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: 'master' | ||
token: ${{ steps.app-token.outputs.token }} | ||
persist-credentials: true | ||
|
||
- name: Download Translations from Crowdin | ||
uses: crowdin/github-action@v1 | ||
with: | ||
upload_sources: false | ||
upload_translations: false | ||
download_translations: true | ||
localization_branch_name: 'l10n_master' | ||
crowdin_branch_name: 'master' | ||
push_translations: false | ||
#commit_message: 'New Crowdin translations' | ||
create_pull_request: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | ||
|
||
- name: Publish any changes to translations to l10n_master branch | ||
if: success() && (github.repository == 'Warzone2100/warzone2100') | ||
id: pushupdates | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "<41898282+github-actions[bot]@users.noreply.github.com>" | ||
git add -A | ||
git commit -m "New Crowdin translations" || { echo "PROCESS_PR=false" >> $GITHUB_OUTPUT && exit 0; } | ||
echo "Pushing changes to l10n_master branch" | ||
git push -f origin master:l10n_master | ||
echo "PROCESS_PR=true" >> $GITHUB_OUTPUT | ||
- name: Create Pull Request to update translations (if needed) | ||
if: success() && (github.repository == 'Warzone2100/warzone2100') && (steps.pushupdates.outputs.PROCESS_PR == 'true') | ||
id: cpr | ||
working-directory: '${{ github.workspace }}/master' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GH_REPO: ${{ github.repository }} | ||
run: | | ||
gh pr create --base "master" --head "l10n_master" --title "New Crowdin translations" --body "New Crowdin translations sync (Auto-generated)" --label "automated pr" || echo "Seems like PR already exists?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Crowdin - Upload Sources | ||
|
||
on: | ||
push: | ||
branches: | ||
# Only upload base files from the master branch! | ||
- 'master' | ||
paths: | ||
# Should match the source paths in crowdin.yml | ||
- 'po/warzone2100.pot' | ||
- 'pkg/nsis/i18n/win_installer_base.nsh' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-master | ||
|
||
jobs: | ||
crowdin-upload-sources: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
environment: crowdin_sync | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: 'master' | ||
|
||
- name: Crowdin Action | ||
uses: crowdin/github-action@v1 | ||
with: | ||
upload_sources: true | ||
upload_translations: false | ||
download_translations: false | ||
crowdin_branch_name: 'master' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters