Mobile Deployment #91
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mobile Deployment | |
on: [deployment_status, workflow_dispatch] | |
jobs: | |
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: | | |
cp resources/app.config.vars.txt my_project/resources/app.config.vars.txt | |
cp resources/eas.vars.txt my_project/resources/eas.vars.txt | |
cd my_project | |
current_dir=$(pwd) | |
. scripts/setup_mobile_config.sh "$current_dir/mobile/app.config.js" "$current_dir/resources/app.config.vars.txt" | |
. scripts/setup_mobile_config.sh "$current_dir/mobile/eas.json" "$current_dir/resources/eas.vars.txt" | |
# - uses: actions/cache@v4 | |
# with: | |
# path: "**/node_modules" | |
# key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} | |
- name: 🏗 Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
# cache: npm | |
# cache-dependency-path: ./mobile/package-lock.json | |
- 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: npm 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" |