Skip to content

Commit

Permalink
Merge pull request #803 from andrew-bierman/feat/upgrade-expo-50
Browse files Browse the repository at this point in the history
⬆️ expo 50 upgrade
  • Loading branch information
andrew-bierman authored May 2, 2024
2 parents 773594e + 7de3286 commit 4c51fe5
Show file tree
Hide file tree
Showing 94 changed files with 6,583 additions and 5,266 deletions.
14 changes: 14 additions & 0 deletions .github/actions/set-env-tokens/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Set Environment Tokens'
description: 'Set environment variables for various tokens'
inputs:
mapbox_token:
description: 'Mapbox Downloads Token'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: Set Mapbox Downloads Token
if: inputs.mapbox_token != ''
run: export MAPBOX_DOWNLOADS_TOKEN=${{ inputs.mapbox_token }}
shell: bash
81 changes: 56 additions & 25 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,77 @@
# Add 'repo' label to any root file changes
repo:
- '*'
# Add 'root' label to any root file changes
# Quotation marks are required for the leading asterisk
root:
- changed-files:
- any-glob-to-any-file: '*'

# Add 'test' label to any change to *.spec.ts and *.spec.js files within the entire repository
test:
- '**/*.spec.ts'
- '**/*.spec.js'
- '**/*.test.ts'
- '**/*.test.js'
- '**/tests/**/*.ts'
- '**/tests/**/*.js'
## Equivalent of the above mentioned configuration using another syntax
docs:
- changed-files:
- any-glob-to-any-file: ['docs/*', 'guides/*', '**/*.md']

# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
feature:
- head-branch: ['^feature', 'feature']

# Add 'release' label to any PR that is opened against the `main` branch
release:
- base-branch: 'main'

# Add 'test' label to any change to *.spec.ts, *.spec.js, *.test.ts, *.test.js files within the entire repository
test:
- changed-files:
- any-glob-to-any-file:
- '**/*.spec.ts'
- '**/*.spec.js'
- '**/*.test.ts'
- '**/*.test.js'
- '**/tests/**/*.ts'
- '**/tests/**/*.js'

# Add 'frontend' label to any change in the 'client' directory
frontend:
- 'apps/**/*.{ts,js}'
- any: ['apps/**/*.ts', 'apps/**/*.js']
all: ['!apps/src/main.ts', '!apps/src/main.js']
- changed-files:
- any-glob-to-any-file:
- 'apps/**/*.{ts,js}'
- any: 'apps/**/*.ts'
- any: 'apps/**/*.js'
- all-globs-to-all-files:
- '!apps/src/main.ts'
- '!apps/src/main.js'

# Add 'backend' label to any change in the 'server' directory
backend:
- 'server/**/*.{ts,js}'
- changed-files:
- any-glob-to-any-file: 'server/**/*.{ts,js}'

# Add the 'AnyChange' label to any changes within the entire repository
AnyChange:
- '**'
- '**/.*'
- '**/.*/**'
- '**/.*/**/.*'
- changed-files:
- any-glob-to-any-file: '**'

# Add 'client' label to any change in the 'apps' directory
client:
- apps/**/*
- changed-files:
- any-glob-to-any-file: 'apps/**/*'

# Add 'expo' label to any changes in the 'apps/expo' directory
expo:
- apps/expo/**/*
- changed-files:
- any-glob-to-any-file: 'apps/expo/**/*'

# Add 'next' label to any changes in the 'apps/next' directory
next:
- apps/next/**/*
- changed-files:
- any-glob-to-any-file: 'apps/next/**/*'

# Add 'vite' label to any changes in the 'apps/vite' directory
vite:
- apps/vite/**/*
- changed-files:
- any-glob-to-any-file: 'apps/vite/**/*'

# Add 'api' label to any changes in the 'api' or 'server' directories
api:
- api/**/*
- server/**/*
- changed-files:
- any-glob-to-any-file:
- 'api/**/*'
- 'server/**/*'
2 changes: 2 additions & 0 deletions .github/secrets/.secrets.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EXPO_TOKEN="your_token_here"
MAPBOX_DOWNLOADS_TOKEN="your_mapbox_token_here"
30 changes: 14 additions & 16 deletions .github/workflows/android-preview-build-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
pull-requests: write
steps:
- name: Check for EXPO_TOKEN
env:
MAPBOX_DOWNLOADS_TOKEN: ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets."
Expand Down Expand Up @@ -63,23 +61,23 @@ jobs:
export MAPBOX_DOWNLOADS_TOKEN=${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
eas build --platform android --profile preview --local
apk_path=$(find . -name '*.apk')
echo "APK Path: ${apk_path}"
echo "apk_path=${apk_path}" >> $GITHUB_ENV
echo "::set-output name=apk_path::${apk_path}"
working-directory: apps/expo
env:
DEBUG: "true"
# continue-on-error: true
continue-on-error: true

# - name: Upload APK
# uses: actions/upload-artifact@v3
# with:
# name: android-apk
# path: ${{ steps.build.outputs.apk_path }}
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: android-apk
path: /home/runner/work/PackRat/PackRat/apps/expo/build-*.apk

# - name: Create Commit Comment
# if: github.event_name == 'push'
# uses: peter-evans/commit-comment@v2
# with:
# body: |
# Android APK build ${{ steps.build.outcome == 'success' && 'completed' || 'failed' }}!
# ${{ steps.build.outcome == 'success' && format('You can download the APK file from the following link:\nhttps://github.com/{0}/actions/runs/{1}#artifacts', github.repository, github.run_id) || 'Please check the workflow logs for more details on the build failure.' }}
- name: Create Commit Comment
if: github.event_name == 'push'
uses: peter-evans/commit-comment@v2
with:
body: |
Android APK build ${{ steps.build.outcome == 'success' && 'completed' || 'failed' }}!
${{ steps.build.outcome == 'success' && format('You can download the APK file from the following link:\nhttps://github.com/{0}/actions/runs/{1}#artifacts', github.repository, github.run_id) || 'Please check the workflow logs for more details on the build failure.' }}
63 changes: 63 additions & 0 deletions .github/workflows/ios-build-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: iOS App Release Build

on:
push:
branches: ['**']
pull_request:
branches: ['**']

jobs:
build:
runs-on: macos-latest

steps:
- name: Setup repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: yarn install

- name: Setup environment variables
run: |
echo "MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOADS_TOKEN" >> $GITHUB_ENV
- name: Prebuild
run: |
echo "Using Mapbox Token: $MAPBOX_DOWNLOADS_TOKEN"
export MAPBOX_DOWNLOADS_TOKEN=${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
yarn run prebuild:expo
- name: Build iOS app
run: |
echo "Using Mapbox Token: $MAPBOX_DOWNLOADS_TOKEN"
export MAPBOX_DOWNLOADS_TOKEN=${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
eas build --platform ios --profile preview --local --non-interactive --output ${{ github.workspace }}/app-release.ipa
env:
DEBUG: 'true'
continue-on-error: true

- name: Upload IPA artifact
uses: actions/upload-artifact@v3
with:
name: app-release
path: ${{ github.workspace }}/app-release.ipa

- name: Create Commit Comment
if: github.event_name == 'push'
uses: peter-evans/commit-comment@v2
with:
body: |
iOS app build ${{ steps.build.outcome == 'success' && 'completed' || 'failed' }}!
${{ steps.build.outcome == 'success' && format('You can download the IPA file from the following link:\nhttps://github.com/{0}/actions/runs/{1}#artifacts', github.repository, github.run_id) || 'Please check the workflow logs for more details on the build failure.' }}
10 changes: 7 additions & 3 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
pull-requests: write

steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout repository
uses: actions/checkout@v3

- name: Labeler
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
97 changes: 13 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,12 @@ cd PackRat
```

3. Set up the environment variables for the client and server.
- If you have access to the development env files, use those. Otherwise, replace the values with your own.
- See the `.env.example` files in the `apps/expo` and `server` directories for the necessary environment variables.
- If you have access to the development env values, use those. Otherwise, replace the values with your own.
- See the `.env.example` file in the root directory for the required environment variables. You can duplicate this file and rename it to `.env.local` to set up your environment variables.
- Note, for the replacement steps, these replaced values should now be strings with the mapbox secret key for download token, in the following format:
```
"sk..."
```

#### Automated Setup (Unix) 🛠️

Expand All @@ -259,103 +263,28 @@ yarn setup

1. Navigate to the `PackRat` directory if you are not already there.

2. Navigate to the `apps/expo` directory.

```
cd apps/expo
```

- Note that for the client to run, you need to also make the following changes:
- Copy the `app.example.json` file and rename it to `app.json`. Open the file and replace the `MAPBOX_DOWNLOADS_TOKEN_FROM_ENV` value with your own Mapbox API key.
- Navigate to the ios directory. Copy the `Podfile.example` file and rename it to `Podfile`. Open the file and replace the `MAPBOX_DOWNLOADS_TOKEN_FROM_ENV` value with your own Mapbox access token.
- Navigate to the android directory. Copy the `gradle.properties.example` file and rename it to `gradle.properties`. Open the file and replace the `MAPBOX_DOWNLOADS_TOKEN_FROM_ENV` value with your own Mapbox downloads token.
- See the [Mapbox documentation](https://docs.mapbox.com/help/getting-started/access-tokens/) for more information on how to obtain Mapbox API keys and access tokens.

2. Duplicate the `.env.example` file and rename it to `.env`. Open the file and replace the values with your own.
- If you have access to the development env file, skip this step. Otherwise, replace the values with your own.

```
cp .env.example .env
```

1. Duplicate the `app.example.json` file and rename it to `app.json`. Open the file and replace the `MAPBOX_DOWNLOADS_TOKEN_FROM_ENV` value with your own Mapbox API key.

```
cp app.example.json app.json
```

4. Navigate to the ios directory.

```
cd ios
```

5. Duplicate the `Podfile.example` file and rename it to `Podfile`. Open the file and replace the `MAPBOX_DOWNLOADS_TOKEN_FROM_ENV` value with your own Mapbox access token.
2. Copy the `.env.example` file and rename it to `.env.local`.
- Open the file and replace the values with your own or use the development env values.
- Note, there is a postinstall script that will copy the .env.local file to the client directories, adding the necessary environment variables with prefixes.

```
cp Podfile.example Podfile
```

6. Navigate to the android directory.

```
cd ../android
```

7. Duplicate the `gradle.properties.example` file and rename it to `gradle.properties`. Open the file and replace the `MAPBOX_DOWNLOADS_TOKEN_FROM_ENV` value with your own Mapbox downloads token.

```
cp gradle.properties.example gradle.properties
```

- Note, for the replacement steps, these replaced values should now be strings with the mapbox secret key for download token, in the following format:

```
"sk..."
```


8. Navigate back to the `PackRat` directory.

```
cd ../..
```

9. Navigate to one of the client directories such as `next`, `expo`, `vite`.

```
cd apps/next
```

10. Duplicate the `.env.example` file and rename it to `.env`. Open the file and replace the values with your own.
- If you have access to the development env file, skip this step. Otherwise, replace the values with your own.

```
cp .env.example .env
```

11. Navigate back to the `PackRat` directory.

```
cd ..
cp .env.example .env.local
```

10. Navigate to the `server` directory.
3. Navigate to the `server` directory.

```
cd server
```

11. Duplicate the `.wrangler.toml.example` file and rename it to `wrangler.toml`. Open the file and replace the values with your own.
4. Duplicate the `.wrangler.toml.example` file and rename it to `wrangler.toml`. Open the file and replace the values with your own.
- If you have access to the development wrangler file, skip this step. Otherwise, replace the values with your own.
-

```
cp .wrangler.toml.example wrangler.toml
```

12. Navigate back to the `PackRat` directory.
5. Navigate back to the `PackRat` directory.

```
cd ..
Expand Down
4 changes: 4 additions & 0 deletions apps/expo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ npm-debug.*
*.orig.*
web-build/

# iOS and Android build folders
ios/
android/

# macOS
.DS_Store

Expand Down
Loading

0 comments on commit 4c51fe5

Please sign in to comment.