Skip to content

Mobile Deployment

Mobile Deployment #20

Workflow file for this run

name: Mobile Deployment
on: [deployment_status, workflow_dispatch]
jobs:
# TODO move this to a common file
Setup:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# Can't use cache because of https://github.com/actions/cache/issues/319
# cache: 'pipenv'
- name: Install bootstrapper dependencies
run: pipenv install --dev --deploy
- run: |
config_file=$(./scripts/vue_or_react.sh)
pipenv run cookiecutter . --config-file $config_file --no-input -f
cat $config_file
- uses: actions/upload-artifact@v4
with:
name: my_project
path: my_project/
retention-days: 1
configuremobile:
needs: Setup
runs-on: ubuntu-latest
outputs:
BUILD_MOBILE_APP: ${{ steps.checkdiff.outputs.BUILD_MOBILE_APP }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
name: check diff
- id: checkdiff
run: |
git fetch origin main
if [ {{ "${{ github.event_name }}" }} == "workflow_dispatch" ]; then
echo "This workflow was triggered by a workflow_dispatch event."
echo "BUILD_MOBILE_APP=1" >> $GITHUB_OUTPUT
else
echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)
echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT
fi
publish:
needs: configuremobile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: my_project
path: my_project/
- name: Create config files
run: |
ls
cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt
cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt
cd my_project
. scripts/setup_mobile_config.sh app.config.js my_project/resources/app-config-js-values.txt
. scripts/setup_mobile_config.sh eas.json my_project/resources/eas-json-values.txt
cat mobile/eas.json
cat mobile/app.config.js
- uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: 🏗 Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: 🏗 Setup Expo and EAS
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: 📦 Install dependencies
working-directory: ./my_project/mobile
run: yarn install
- name: 🚀 Publish preview
working-directory: ./my_project/mobile
run: |
eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto
echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}"
env:
EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}"
EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7"