|
| 1 | +name: Nightly Build |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 5 * * *" |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +# Don't let two nightly builds run at once if a previous run is still going. |
| 9 | +concurrency: |
| 10 | + group: nightly |
| 11 | + cancel-in-progress: false |
| 12 | + |
| 13 | +jobs: |
| 14 | + testflight: |
| 15 | + name: Build and submit to TestFlight |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: 🏗 Checkout repository |
| 19 | + uses: actions/checkout@v6 |
| 20 | + with: |
| 21 | + # Need enough history for the "code changes in last 24h" check. |
| 22 | + fetch-depth: 50 |
| 23 | + |
| 24 | + - name: 🔍 Check for code changes since last build |
| 25 | + id: changes |
| 26 | + if: github.event_name == 'schedule' |
| 27 | + run: | |
| 28 | + changed=$(git log --since='24 hours ago' --name-only --format= | sort -u) |
| 29 | + code_changed=$(echo "$changed" | grep -vE '^(docs/|.*\.md$|^$)' || true) |
| 30 | + if [ -z "$code_changed" ]; then |
| 31 | + echo "No code changes in the last 24 hours; skipping nightly build." |
| 32 | + echo "skip=true" >> "$GITHUB_OUTPUT" |
| 33 | + else |
| 34 | + echo "Code changes detected:" |
| 35 | + echo "$code_changed" |
| 36 | + echo "skip=false" >> "$GITHUB_OUTPUT" |
| 37 | + fi |
| 38 | +
|
| 39 | + - name: 🏗 Setup Node.js |
| 40 | + if: steps.changes.outputs.skip != 'true' |
| 41 | + uses: actions/setup-node@v6 |
| 42 | + with: |
| 43 | + node-version: "22" |
| 44 | + cache: "npm" |
| 45 | + |
| 46 | + - name: 🏗 Setup EAS |
| 47 | + if: steps.changes.outputs.skip != 'true' |
| 48 | + uses: expo/expo-github-action@v8 |
| 49 | + with: |
| 50 | + eas-version: latest |
| 51 | + token: ${{ secrets.EXPO_TOKEN }} |
| 52 | + |
| 53 | + - name: 📦 Install dependencies |
| 54 | + if: steps.changes.outputs.skip != 'true' |
| 55 | + run: npm ci |
| 56 | + |
| 57 | + - name: 🛠 Build for TestFlight |
| 58 | + if: steps.changes.outputs.skip != 'true' |
| 59 | + run: eas build --non-interactive --platform ios --profile production |
| 60 | + |
| 61 | + - name: 🚀 Submit to TestFlight |
| 62 | + if: steps.changes.outputs.skip != 'true' |
| 63 | + run: eas submit --non-interactive --platform ios --profile production --latest |
0 commit comments