diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a6230fb..e9a230d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,9 @@ -name: Push to Master/Main CI +name: Push to Main CI on: push: branches: - main - - master permissions: contents: write diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.yml new file mode 100644 index 00000000..cbead21d --- /dev/null +++ b/.github/workflows/crowdin-download.yml @@ -0,0 +1,35 @@ +name: Crowdin Download Translations Action + +on: + schedule: # Every Sunday at midnight + - cron: '0 0 * * 0' + workflow_dispatch: # Allow manual triggering + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download translations with Crowdin + uses: crowdin/github-action@v2 + with: + base_url: 'https://meshtastic.crowdin.com/api/v2' + config: 'crowdin.yml' + upload_sources: false + upload_translations: false + download_translations: true + localization_branch_name: i18n_crowdin_translations + commit_message: 'chore(i18n): New Crowdin Translations by GitHub Action' + create_pull_request: true + pull_request_title: 'chore(i18n): New Crowdin Translations' + pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)' + pull_request_base_branch_name: 'main' + pull_request_labels: 'i18n' + crowdin_branch_name: 'main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/crowdin-upload-sources.yml b/.github/workflows/crowdin-upload-sources.yml new file mode 100644 index 00000000..f3013901 --- /dev/null +++ b/.github/workflows/crowdin-upload-sources.yml @@ -0,0 +1,28 @@ +name: Crowdin Upload Sources Action + +on: + push: # Watch source en.json for changes on main + paths: [ '/src/i18n/locales/en.json' ] + branches: [ main ] + workflow_dispatch: # Allow manual triggering + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Upload sources with Crowdin + uses: crowdin/github-action@v2 + with: + base_url: 'https://meshtastic.crowdin.com/api/v2' + config: 'crowdin.yml' + upload_sources: true + upload_translations: false + download_translations: false + crowdin_branch_name: 'main' + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/crowdin-upload-translations.yml b/.github/workflows/crowdin-upload-translations.yml new file mode 100644 index 00000000..e5e94010 --- /dev/null +++ b/.github/workflows/crowdin-upload-translations.yml @@ -0,0 +1,25 @@ +name: Crowdin Upload Translations Action + +on: + workflow_dispatch: # Allow manual triggering + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Upload translations with Crowdin + uses: crowdin/github-action@v2 + with: + base_url: "https://meshtastic.crowdin.com/api/v2" + config: "crowdin.yml" + upload_sources: false + upload_translations: true + download_translations: false + crowdin_branch_name: "main" + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.github/workflows/update-stable-from-master.yml b/.github/workflows/update-stable-from-master.yml index c77f1c72..692c164d 100644 --- a/.github/workflows/update-stable-from-master.yml +++ b/.github/workflows/update-stable-from-master.yml @@ -1,4 +1,4 @@ -name: Update Stable Branch from Master on Latest Release +name: Update Stable Branch from Main on Latest Release on: release: @@ -9,7 +9,7 @@ permissions: jobs: update-stable-branch: - name: Update Stable Branch from Master + name: Update Stable Branch fromMain runs-on: ubuntu-latest steps: @@ -24,14 +24,14 @@ jobs: git config user.name "GitHub Actions Bot" git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Fetch latest master and stable branches + - name: Fetch latest main and stable branches run: | - git fetch origin master:master + git fetch origin main:main git fetch origin stable:stable || echo "Stable branch not found remotely, will create." - - name: Get latest master commit SHA - id: get_master_sha - run: echo "MASTER_SHA=$(git rev-parse master)" >> $GITHUB_ENV + - name: Get latest main commit SHA + id: get_main_sha + run: echo "MAIN_SHA=$(git rev-parse main)" >> $GITHUB_ENV - name: Check out stable branch run: | @@ -39,12 +39,12 @@ jobs: git checkout stable git pull origin stable # Sync with remote stable if it exists else - echo "Creating local stable branch based on master HEAD." - git checkout -b stable ${{ env.MASTER_SHA }} + echo "Creating local stable branch based on main HEAD." + git checkout -b stable ${{ env.MAIN_SHA }} fi - - name: Reset stable branch to latest master - run: git reset --hard ${{ env.MASTER_SHA }} + - name: Reset stable branch to latest main + run: git reset --hard ${{ env.MAIN_SHA }} - name: Force push stable branch run: git push origin stable --force \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 00000000..c333b38a --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,10 @@ +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path": "." +"base_url": "https://meshtastic.crowdin.com/api/v2" + +"preserve_hierarchy": true + +files: + - source: /src/i18n/locales/en.json + translation: /src/i18n/locales/%two_letters_code%.json