|
| 1 | +name: deploy |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + target: |
| 7 | + description: Deploy as preview or production |
| 8 | + type: choice |
| 9 | + required: true |
| 10 | + default: preview |
| 11 | + options: |
| 12 | + - preview |
| 13 | + - production |
| 14 | + push: |
| 15 | + branches: [main] |
| 16 | + pull_request: |
| 17 | + types: [opened, synchronize] |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +env: |
| 24 | + EXPO_USE_FAST_RESOLVER: true # Use the faster Metro resolver in SDK 51 |
| 25 | + |
| 26 | +jobs: |
| 27 | + example: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: 🏗 Setup repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: 🏗 Setup monorepo |
| 34 | + uses: ./.github/actions/setup-monorepo |
| 35 | + |
| 36 | + - name: ✅ Build apps/example |
| 37 | + run: pnpm run -w build:example |
| 38 | + |
| 39 | + - name: 🌐 Export apps/example for web |
| 40 | + working-directory: apps/example |
| 41 | + run: pnpm expo export --platform web --output-dir ./build |
| 42 | + |
| 43 | + # You can remove this step if you already configured this |
| 44 | + # This project shouldn't be pre-configured with this ID, that's why its omitted |
| 45 | + - name: 👷 Configure project |
| 46 | + working-directory: apps/example |
| 47 | + run: eas init --id d202a56f-0162-450d-af3b-a2d2e0678594 --force --non-interactive |
| 48 | + |
| 49 | + - name: 🚀 Deploy apps/example preview |
| 50 | + if: ${{ github.event_name == 'pull_request' || github.event.inputs.target == 'preview' }} |
| 51 | + working-directory: apps/example |
| 52 | + run: eas deploy --export-dir ./build |
| 53 | + |
| 54 | + - name: 🚀 Deploy apps/example production |
| 55 | + if: ${{ (github.event_name == 'push' && github.ref_name == 'main') || github.event.inputs.target == 'production' }} |
| 56 | + working-directory: apps/example |
| 57 | + run: eas deploy --export-dir ./build --production |
0 commit comments