Skip to content

🚀 Build and Deploy App #21

🚀 Build and Deploy App

🚀 Build and Deploy App #21

Workflow file for this run

name: 🚀 Build and Deploy App
on:
workflow_run:
workflows: ["Lint"]
branches: [main]
types:
- completed
workflow_dispatch:
inputs:
os:
type: choice
description: OS to build on
options:
- macos-latest
- ubuntu-latest
platform:
type: choice
description: Platform to build for
options:
- android
- ios
profile:
type: choice
description: Build profile to use
options:
- development
- preview
- production
env:
platform: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.platform || vars.DEFAULT_PLATFORM }}
profile: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.profile ||vars.DEFAULT_PROFILE }}
jobs:
build:
name: 🚀 Build and Deploy App
runs-on: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.os ||vars.DEFAULT_OS }}
strategy:
matrix:
node: [18.x]
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v2
- name: 🏗 Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
name: 🏗 Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: 🏎️ Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 🏎️ Cache Pods
if: runner.os == 'macOS'
uses: actions/cache@v3
id: pods-cache
with:
path: ./apps/expo/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('apps/expo/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: 🛠️ Install dependencies
run: pnpm install
- name: 🏗 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: 👷 Build packages
run: "pnpm run build"
- name: 👷 Build app
working-directory: apps/expo
run: |
eas build --local \
--non-interactive \
--output=./app-${{ env.platform }}-${{ env.profile }}.${{ env.platform == 'android' && 'apk' || 'ipa' }} \
--platform=${{ env.platform }} \
--profile=${{ env.profile }}
- name: 📱 Upload binary
uses: actions/upload-artifact@v2
with:
name: app-${{ env.platform }}-${{ env.profile }}.${{ env.platform == 'android' && 'apk' || 'ipa' }}
path: ${{ github.workspace }}/apps/expo/app-${{ env.platform }}-${{ env.profile }}.${{ env.platform == 'android' && 'apk' || 'ipa' }}
- name: 🚀 Submit to Store
working-directory: apps/expo
if: env.profile == 'production'
run: |
eas submit --platform=${{ env.platform }} --non-interactive --path=./app-${{ env.platform }}-${{ env.profile }}.${{ env.platform == 'android' && 'apk' || 'ipa' }}