Scheduled Updates (Firmware, Hardware, Translations) #3510
This file contains hidden or 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
| name: Scheduled Updates (Firmware, Hardware, Translations) | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Run every hour | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| update_assets: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'meshtastic/Meshtastic-Android' | |
| permissions: | |
| contents: write # To commit files and push branches | |
| pull-requests: write # To create pull requests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.CROWDIN_GITHUB_TOKEN }} | |
| - name: Update firmware releases list | |
| run: | | |
| firmware_file_path="app/src/main/assets/firmware_releases.json" | |
| temp_firmware_file="/tmp/new_firmware_releases.json" | |
| echo "Fetching latest firmware releases..." | |
| curl -s --fail https://api.meshtastic.org/github/firmware/list > "$temp_firmware_file" | |
| if ! jq empty "$temp_firmware_file" 2>/dev/null; then | |
| echo "::error::Firmware API returned invalid JSON data. Skipping firmware update." | |
| else | |
| if [ ! -f "$firmware_file_path" ] || ! jq --sort-keys . "$temp_firmware_file" | diff -q - <(jq --sort-keys . "$firmware_file_path"); then | |
| echo "Changes detected in firmware list or local file missing. Updating $firmware_file_path." | |
| cp "$temp_firmware_file" "$firmware_file_path" | |
| else | |
| echo "No changes detected in firmware list." | |
| fi | |
| fi | |
| - name: Update hardware list | |
| run: | | |
| hardware_file_path="app/src/main/assets/device_hardware.json" | |
| temp_hardware_file="/tmp/new_device_hardware.json" | |
| echo "Fetching latest device hardware data..." | |
| curl -s --fail https://api.meshtastic.org/resource/deviceHardware > "$temp_hardware_file" | |
| if ! jq empty "$temp_hardware_file" 2>/dev/null; then | |
| echo "::error::Hardware API returned invalid JSON data. Skipping hardware update." | |
| else | |
| if [ ! -f "$hardware_file_path" ] || ! jq --sort-keys . "$temp_hardware_file" | diff -q - <(jq --sort-keys . "$hardware_file_path"); then | |
| echo "Changes detected in hardware list or local file missing. Updating $hardware_file_path." | |
| cp "$temp_hardware_file" "$hardware_file_path" | |
| else | |
| echo "No changes detected in hardware list." | |
| fi | |
| fi | |
| - name: Sync with Crowdin | |
| uses: crowdin/github-action@v2 | |
| with: | |
| base_url: 'https://meshtastic.crowdin.com/api/v2' | |
| config: 'crowdin.yml' | |
| crowdin_branch_name: 'main' | |
| upload_sources: true | |
| upload_sources_args: '--preserve-hierarchy' | |
| upload_translations: false | |
| download_translations: true | |
| download_translations_args: '--preserve-hierarchy' | |
| create_pull_request: false | |
| commit_message: 'chore(l10n): New Crowdin Translations from scheduled update' | |
| push_translations: false | |
| push_sources: false | |
| localization_branch_name: ${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.CROWDIN_GITHUB_TOKEN }} | |
| CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | |
| CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
| - name: Create Pull Request if changes occurred | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.CROWDIN_GITHUB_TOKEN }} | |
| commit-message: | | |
| chore: Scheduled updates (Firmware, Hardware, Translations) | |
| Automated updates for: | |
| - Firmware releases list | |
| - Device hardware list | |
| - Crowdin source string uploads | |
| - Crowdin translation downloads | |
| title: 'chore: Scheduled updates (Firmware, Hardware, Translations)' | |
| body: | | |
| This PR includes automated updates from the scheduled workflow: | |
| - Updated `firmware_releases.json` from the Meshtastic API (if changed). | |
| - Updated `device_hardware.json` from the Meshtastic API (if changed). | |
| - Source strings were uploaded to Crowdin. | |
| - Latest translations were downloaded from Crowdin (if available). | |
| Please review the changes. | |
| branch: 'scheduled-updates' | |
| base: 'main' | |
| delete-branch: true | |
| labels: | | |
| automation | |
| l10n | |
| firmware | |
| hardware | |
| check-workflow-status: | |
| name: Check Workflow Status | |
| runs-on: ubuntu-latest | |
| needs: | |
| - update_assets | |
| if: always() | |
| steps: | |
| - name: Check Workflow Status | |
| if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')" | |
| run: | | |
| echo "One of the dependent jobs failed or was cancelled. Failing the workflow." | |
| exit 1 |