Repository navigation
Mobile internal builds #2
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: Mobile internal builds | |
| # App changes land on main in bursts, so a Codemagic build per merge is mostly superseded minutes | |
| # later. Codemagic's own triggering has no rate limit, so the push trigger is replaced by this: | |
| # a three-hourly batch that builds only when app code changed, plus an immediate build for an | |
| # allowlisted author who needs their own change on a device now. Anyone else can still start a | |
| # build by hand, here or in Codemagic. | |
| on: | |
| push: | |
| branches: [main] | |
| paths: ['app/**'] | |
| schedule: | |
| - cron: '0 */3 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: mobile-internal-build | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| env: | |
| # Abort a git HTTP transfer that stays under 1 KB/s for 60 s, so actions/checkout | |
| # retries instead of hanging 7-10 min until the TCP reset (#22890). | |
| GIT_HTTP_LOW_SPEED_LIMIT: "1000" | |
| GIT_HTTP_LOW_SPEED_TIME: "60" | |
| jobs: | |
| dispatch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| # The schedule run compares main against the last commit Codemagic built. | |
| fetch-depth: 0 | |
| # Keep the checkout bound to the event's immutable source while main may advance. | |
| ref: ${{ github.sha }} | |
| - name: Collect commit authors | |
| id: authors | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| run: | | |
| if [ "$EVENT_NAME" != "push" ]; then | |
| echo "authors=" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| authors="$(jq -r '[.commits[]?.author.username // empty] | unique | join(",")' "$GITHUB_EVENT_PATH")" | |
| echo "authors=${authors}" >> "$GITHUB_OUTPUT" | |
| - name: Decide and dispatch | |
| env: | |
| CODEMAGIC_API_TOKEN: ${{ secrets.CODEMAGIC_API_TOKEN }} | |
| CODEMAGIC_APP_ID: ${{ vars.CODEMAGIC_APP_ID || '66c95e6ec76853c447b8bcbb' }} | |
| MOBILE_INSTANT_BUILD_ACTORS: ${{ vars.MOBILE_INSTANT_BUILD_ACTORS || 'mdmohsin7' }} | |
| run: | | |
| set -euo pipefail | |
| python3 .github/scripts/dispatch_mobile_internal_builds.py \ | |
| --event "${{ github.event_name }}" \ | |
| --actor "${{ github.actor }}" \ | |
| --commit-authors "${{ steps.authors.outputs.authors }}" \ | |
| --app-id "$CODEMAGIC_APP_ID" \ | |
| --branch main \ | |
| --source-sha "$GITHUB_SHA" | tee "$RUNNER_TEMP/dispatch.txt" | |
| { | |
| echo "### Mobile internal builds" | |
| echo | |
| echo '```' | |
| cat "$RUNNER_TEMP/dispatch.txt" | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" |