Folo/.github/workflows/build-eas-development.yml

130 lines
3.6 KiB
YAML

name: Build iOS IPA for development
on:
push:
branches: [dev]
paths:
- "apps/mobile/web-app/**"
- "apps/mobile/native/**"
- "apps/mobile/package.json"
pull_request:
branches: [dev]
paths:
- "apps/mobile/web-app/**"
- "apps/mobile/native/**"
- "apps/mobile/package.json"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-runner:
runs-on: ubuntu-latest
outputs:
runner-label: ${{ steps.set-runner.outputs.runner-label }}
steps:
- name: Set runner
id: set-runner
run: |
runners=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.RUNNER_GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners")
available=$(echo "$runners" | jq '.runners[]? | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")')
if [ -n "$available" ]; then
echo "runner-label=self-hosted" >> $GITHUB_OUTPUT
else
echo "runner-label=macos-latest" >> $GITHUB_OUTPUT
fi
build:
name: Build iOS IPA for device
if: github.secret_source != 'None'
needs: check-runner
runs-on: ${{ needs.check-runner.outputs.runner-label }}
steps:
- name: 📦 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup pnpm
if: needs.check-runner.outputs.runner-label == 'macos-latest'
uses: pnpm/action-setup@v4
- name: 🏗 Setup Node.js
if: needs.check-runner.outputs.runner-label == 'macos-latest'
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: 📱 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: pnpm install
- name: 🔨 Build iOS IPA
run: |
cd apps/mobile
eas build --platform ios --profile development --non-interactive --local --output=./build.ipa
env:
CI: true
# Optional: Upload artifact
- name: 📤 Upload IPA
uses: actions/upload-artifact@v4
with:
name: app-ios
path: apps/mobile/build.ipa
retention-days: 90
- name: Clear Xcode cache
if: needs.check-runner.outputs.runner-label == 'self-hosted'
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData
build-simulator:
name: Build iOS IPA for simulator
if: github.secret_source != 'None'
runs-on: macos-latest
steps:
- name: 📦 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup pnpm
uses: pnpm/action-setup@v4
- name: 🏗 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: 📱 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: pnpm install
- name: 🔨 Build iOS IPA
run: |
cd apps/mobile
eas build --platform ios --profile ios-simulator --non-interactive --local --output=./build-simulator.ipa
env:
CI: true
# Optional: Upload artifact
- name: 📤 Upload IPA
uses: actions/upload-artifact@v4
with:
name: app-ios-simulator
path: apps/mobile/build-simulator.ipa
retention-days: 90