Review implicit intents content #1762
Workflow file for this run
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: Build All iOS Demos | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'demos/ios/**' | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - 'demos/**' | |
| - '.github/workflows/build-ios-demos.yml' | |
| jobs: | |
| generate-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| sparse-checkout: demos/ios | |
| fetch-depth: 2 # Required for git diff in PRs | |
| - name: Generate matrix | |
| id: set-matrix | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| # Get list of changed files in demos/ios/ directory | |
| changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD -- 'demos/ios/*') | |
| echo "Changed files:" | |
| echo "$changed_files" | |
| # Extract unique demo directories | |
| matrix=$(echo "$changed_files" | grep -oE 'demos/ios/[^/]*/MASTG-DEMO-[^/]+' | sort -u | head -c -1 | tr '\n' ' ' | sed 's/ /","/g') | |
| # If no changes, set empty matrix | |
| if [ -z "$matrix" ]; then | |
| echo "matrix={\"demo\":[]}" >> $GITHUB_OUTPUT | |
| else | |
| echo "matrix={\"demo\":[\"$matrix\"]}" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| # Default behavior: include all demos for master branch | |
| matrix=$(echo demos/ios/*/MASTG-DEMO-* | sed 's/ /","/g') | |
| echo "matrix={\"demo\":[\"$matrix\"]}" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Print matrix: $matrix" | |
| build: | |
| needs: generate-matrix | |
| if: ${{ needs.generate-matrix.outputs.matrix != '{"demo":[]}' }} | |
| runs-on: macos-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
| max-parallel: 3 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| sparse-checkout: ${{ matrix.demo }} | |
| - name: Clone mas-app-ios repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: cpholguera/mas-app-ios | |
| path: mas-app-ios | |
| - name: Install dependencies | |
| run: brew install ldid | |
| - name: Replace files with demo and prepare build | |
| run: | | |
| demo="${{ matrix.demo }}" | |
| [ -d "$demo" ] || ( | |
| echo "Demo directory not found: $demo" | |
| exit 1 | |
| ) | |
| echo "Processing $demo" | |
| [ -f "$demo/MastgTest.swift" ] && cp -f "$demo/MastgTest.swift" mas-app-ios/MASTestApp/MastgTest.swift && echo "Copied MastgTest.swift for $demo" || echo "No MastgTest.swift found for $demo" | |
| [ -f "$demo/Info.plist" ] && cp -f "$demo/Info.plist" mas-app-ios/MASTestApp/Info.plist && echo "Copied Info.plist for $demo" || echo "No Info.plist found for $demo" | |
| - name: Build, sign, and package IPA | |
| run: | | |
| demo="${{ matrix.demo }}" | |
| IPA_NAME="$(basename "$demo").ipa" | |
| EXTRA_ENTITLEMENTS="" | |
| [ -f "$demo/MASTestApp.entitlements" ] && EXTRA_ENTITLEMENTS="$GITHUB_WORKSPACE/$demo/MASTestApp.entitlements" | |
| ./mas-app-ios/.github/scripts/build-and-package.sh "$IPA_NAME" "$EXTRA_ENTITLEMENTS" | |
| echo "IPA_NAME=$IPA_NAME" >> $GITHUB_ENV | |
| - name: Upload IPA | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: "${{ env.IPA_NAME }}" | |
| path: "${{ github.workspace }}/mas-app-ios/output/${{ env.IPA_NAME }}" | |
| if-no-files-found: error |