Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: 'CI PR Code Quality'
on: [pull_request]
jobs:
code-quality-and-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 14

steps:
Expand Down
433 changes: 70 additions & 363 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ExpoConfig, IOS } from '@expo/config-types'

import packageJson from './package.json'

import type { OtaUpdatePriority } from '~/hooks/useOTAUpdate'
import type { OtaUpdatePriority } from '~/features/versionCheck/hooks/useOTAUpdate'
import { Environment } from '~/types/env'

declare const process: {
Expand Down Expand Up @@ -35,8 +35,8 @@ const environment = process.env.EXPO_PUBLIC_APP_ENV || 'dev'
// your custom fonts
const fonts = ['./assets/fonts/Domine-Bold.ttf']

// prefetched/embedded assets, can be referenced as source='rn_meme' https://docs.expo.dev/versions/latest/sdk/asset/#configurable-properties
const assets = ['./assets/images/rn_meme.jpg']
// prefetched/embedded assets, can be referenced as source='strv_logo' https://docs.expo.dev/versions/latest/sdk/asset/#configurable-properties
const assets = ['./assets/images/strv_logo.png']

const getEnvironmentInfo = (): {
name: ExpoConfig['name']
Expand Down Expand Up @@ -83,7 +83,7 @@ const expoConfig: ExpoConfig = {
slug: config.appScheme,
version,
runtimeVersion: {
policy: 'sdkVersion',
policy: 'fingerprint',
},
scheme: config.appScheme,
orientation: 'portrait',
Expand Down
2 changes: 1 addition & 1 deletion app/(home)/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Dashboard as default } from '~/features/dashboard/screens/DashboardScreen'
export { DashboardScreen as default } from '~/features/dashboard/screens/DashboardScreen'
Binary file removed assets/images/rn_meme.jpg
Binary file not shown.
Binary file added assets/images/strv_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions docs/eas-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# EAS Build Setup

> ❓ EAS helps with building and app submission. It can create and store all important credentials so that we don't have to distribute them among everyone.

## eas.json config

- Default build profiles in `eas.json`:
- `dev` - this profile will build an `expo-dev-client`, meaning that after installing the app, one can change non-native code and see changes reflected in the app
- `staging` - should be distributed for testing, does not have a dev client, meaning it cannot be manipulated. It builds `com.xxx.xxx.staging` application which can be distributed through a link or a QR code.

> For iOS, we need to add devices for EAS testing (development, staging) via `eas device:create` (creates sharable registration link) and confirm the device has been added. It is good to write down your unique device ID to understand what is your device.

- `production` - non-distributable build that should be submitted to Play Store and App Store. Can be tested through Play Store internal testing track or Testflight. It builds the official `com.xxx.xxx` package later released to production.

### EAS account config

- Setup your project with your EAS account by running:
```
npx eas init
```

### Credentials

- Set up` App Store Connect API Keys` for `staging` and `production` by running:
```
npx eas credentials -p ios
```

### Before first build

To allow the GitHub Action to conduct builds, you must build the app for the first time using the `EAS` CLI. This will create the necessary credentials and allow the GitHub Action to access them.

Run the following commands:

```
npx eas build --platform ios --profile dev-sim
npx eas build --platform ios --profile dev
npx eas build --platform ios --profile staging --auto-submit
npx eas build --platform ios --profile production --auto-submit
```

### OTA updates setup

- Add the Expo URL to the `expoConfig` in` app.config.ts`.

```
updates: {
fallbackToCacheTimeout,
url: 'https://u.expo.dev/project-id',
},
```

- Before conducting over-the-air updates, validate that the channels are setup against correct branch (environment).

```
npx eas channel:list
```

- if not, you can change it by running

```
npx eas channel:edit
```
67 changes: 67 additions & 0 deletions docs/github-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Github Actions

> ❓ We have found github actions to be the best way to trigger the builds. It does not require any git knowledge to i.e push a tag so almost anyone
> with access can do it. We have created workflows that should work for almost any possible scenario.

### Development Build:

**Description**:

- Development are used for local development and testing on Simulator. This is the fastest way to iterate on the app.
- Development build should be created every time there is a change affecting Native code or when a new feature is added.

_- note: if you want to test the app on a real device, and your device is not registered in EAS, you can do it by running `npx eas device:create `_

**Steps**:

- Workflow: `Create dev build`
- Build type: `dev`(real device) | `dev-sim`(simulator)
- Platform: `all` | `ios` | `android`

### Staging Release:

**Description**:

- Staging builds are used for testing new features and bug fixes before they are released to production.
- After the staging build is created, the new release is created with the changelogs and it shared via Testflight or Play Store internal testing track.

**Steps**:

- Workflow: `Create release`
- Deployment environment: `staging`
- Version bump type: `patch` | `minor` | `major` | `none`
- Action type: `build and submit` | `ota update`
- Platform: `all` | `ios` | `android`

### Production Submit:

**Description**:

- After the staging build is tested and approved, we are ready to submit the build to the stores.

**Steps**:

- Workflow: `Production submit` (triggered from the `tag` branch chosen via `Use workflow from` dropdown)
- Platform: `all` | `ios` | `android`

### Example of _ideal_ scenario:

Working on a new feature (v. `1.2.1`)

- **Create dev build** Select `dev` for device build or `dev-sim` for simulator build and `platform`
- This creates a dev build that serves for local development
- After the feature is finished and merged to `main`, we trigger **Create release** and we select -> `staging` platform, version bump type `minor`, and action type will be `build and submit`
- This creates a new build, submits it for testing, and creates a new release `1.3.0` with `changelogs`
- After QA testing, we are ready for production submission via `Production submit` flow. This will create a new build with the version of the selected `tag` branch and submit it to the stores

### Hotfix Scenario:

- We found a bug in version `1.3.0` - we create a new branch from the `1.3.0` `tag` branch
- Fix the bug and create a **PR**
- Review the **PR** and then we create a `hotfix` by triggering **Hotfix release**, selecting the current Hotfix branch and selecting the `build type` (either OTA or Normal)
- This creates a new tag `1.3.0-hotfix.1` but no release
- Merge the hotfix branch to `main`

### Build number:

Build number is stored in GitHub variables as `BUILD_NUMBER`. If it's not present, it creates a new one with version 1.
66 changes: 66 additions & 0 deletions docs/github-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# GitHub Setup Instructions

> ❓ For our actions to work, we need to setup some things in GitHub. Otherwise these actions won't be able to push changes like a new release tag or a changelog to the repository.

## Expo Access Token

1. Create a new token in the Expo dashboard.
2. Add the token to the GitHub secrets as `EXPO_TOKEN`.

## GitHub Workflow Permissions

1. Go to `Settings` > `Actions` > `General` > `Workflow permissions`.
2. Check `Read and write permissions`.

## GitHub Personal Access Token

1. Navigate to your GitHub profile > `Settings` > `Developer settings` > `Personal access tokens` > `Fine-grained tokens`.
2. Click on `Generate a new token`.
3. Set the permissions as shown in the table below.
4. Add the token to the GitHub secrets as `GT_PAT`.

#### Required Permissions Table

When setting up the Fine-grained Personal Access Token, ensure you select the following permissions:

| Permission | Access Level |
| --------------- | -------------- |
| Actions | Read and write |
| Commit statuses | Read and write |
| Contents | Read and write |
| Deployments | Read and write |
| Environments | Read and write |
| Merge queues | Read and write |
| Metadata | Read-only |
| Pull requests | Read and write |
| Secrets | Read and write |
| Variables | Read and write |
| Webhooks | Read and write |

## Github Deploy Key

This is necessary for release builds to allow Github Actions to bypass branch protection rules to push the changelog and updated version directly to main.

1. generate a new SSH key pair on your machine:

```bash
ssh-keygen -t rsa -b 4096 -C "[email protected]"
```

- Follow the steps and save the key pair in the `~/.ssh` directory.
- Be sure not to set a passcode on your key otherwise it will not work.
- This will generate two files: `id_rsa` (private key) and `id_rsa.pub` (public key).

1. Add the public key to the repository settings:

- Go to the repository settings > Deploy keys > Add deploy key
- Paste the public key
- Check the `Allow write access` option

2. Add the private key to the Github secrets:

- Go to the repository settings > Secrets > Actions > New repository secret
- Name the secret `SSH_PRIVATE_KEY` and paste the private key
- Be sure to paste the entire content of the file, starting with `-----BEGIN OPENSSH PRIVATE KEY-----` and ending with `-----END OPENSSH PRIVATE KEY-----`

Then when you create rule sets in the branch protection rules, you select the `Deploy keys` option to allow release build action to bypass them and push changelog and updated version directly to main.
13 changes: 13 additions & 0 deletions docs/jira-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### JIRA Integration

> ❓ To track the progress of the project on the Jira board automatically without the need to move tickets manually.

1. Connect the Jira project with the GitHub repository via the `GitHub for Jira` App.
2. Go to `Settings` -> `Features`, scroll to the `Operation` section, and turn on the `Deployments` feature.

To track progress such as `Builds`, `Releases`, and `Commits`, both branch name and pull request title need to include the Jira ticket number in their titles:

Branch name example: `feat/ABC-1234-add-new-feature`
PR title example: `feat(ABC-1234): add new feature`

It is recommended to use the `Squash and merge` option for pull requests. This format is supported by the `release-it` Changelog plugin.
Empty file removed docs/release-process.md
Empty file.
64 changes: 64 additions & 0 deletions docs/slack-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Slack Setup

> ❓ Our github actions support several notification types to Slack to notify the team about the build status.

But there is some additional setup both in Slack and on EAS to make this work.

- **Staging and Production Notifications:**

1. Open Slack
2. In the left sidebar, click on `... More` and select `Automations`
3. Click on `New Workflow`
4. name it `[App name] [Env] [Release]`
5. Choose `from a webhook` option
6. add data variables for `version` - string and `changelog`(optional) - string
7. add `Messages` step and select the `channel` where you want to send the message
8. Add the message

Example message:

```
Hey @channel, :rocket:

We’re excited to announce the release of the new EXPO-TEMPLATE app version!

Latest version: {{version}}
Changelog: https://github.com/strvcom/{repository-name}/releases/tag/v{{version}}
```

- you must create workflow for both `staging` and `production` environments

- Copy the `webhook URL` and add it
- for [STAGING](.release-it.json) - `line 34`
- for [PRODUCTION](.github/workflows/production-submit.yml) - `line 64`

**Dev build notifications**

- the dev distribution builds are triggered by the `Create dev build` workflow
- To distribute the dev builds to among the team members, choose one of the options and follow the steps below:

### SLACK APP

- Create a new Slack App on https://api.slack.com/apps
- Select `Incoming Webhooks` and turn it on
- Wait for the approval
- Add `New Webhook to Workspace` and select the channel
- copy the` Webhook URL`

### CLOUDFLARE WORKERS

This is necessary to include the QR code to download the app in the notification message.

- Go to https://www.cloudflare.com/
- Create a new Cloudflare Worker
- Copy the worker functionality from the [worker.js](docs/cloudflare-worker.txt)
- replace `SLACK_WEBHOOK_URL` variable with yours
- deploy the worker

### EAS SETUP

- create a new webhook via EAS CLI and the worker url `https//your-worker.account-name.workers.dev`

```
eas webhook:create
```
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
preset: 'jest-expo',
moduleNameMapper: {
'^~/(.*)$': '<rootDir>/src/$1',
'^package.json$': '<rootDir>/package.json',
},
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,35 @@
"preinstall": "npx only-allow pnpm"
},
"dependencies": {
"@dev-plugins/react-native-mmkv": "^0.0.1",
"@dev-plugins/react-native-mmkv": "^0.2.0",
"@react-native-community/netinfo": "11.4.1",
"expo": "^52.0.24",
"expo-build-properties": "~0.13.1",
"expo-constants": "~17.0.3",
"expo-dev-client": "~5.0.8",
"expo-image": "~2.0.3",
"expo-linking": "~7.0.3",
"expo-router": "~4.0.16",
"expo-splash-screen": "~0.29.19",
"expo-status-bar": "~2.0.0",
"expo-system-ui": "~4.0.6",
"expo-updates": "~0.26.11",
"expo": "^52.0.44",
"expo-build-properties": "~0.13.2",
"expo-constants": "~17.0.8",
"expo-dev-client": "~5.0.20",
"expo-image": "~2.0.7",
"expo-linking": "~7.0.5",
"expo-router": "~4.0.20",
"expo-splash-screen": "~0.29.22",
"expo-status-bar": "~2.0.1",
"expo-system-ui": "~4.0.9",
"expo-updates": "~0.27.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.76.5",
"react-native": "0.76.9",
"react-native-gesture-handler": "~2.20.2",
"react-native-mmkv": "^3.2.0",
"react-native-reanimated": "~3.16.6",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "4.4.0",
"react-native-web": "~0.19.13",
"zustand": "^4.5.2"
"semver": "^7.7.1"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@release-it/conventional-changelog": "^8.0.1",
"@strv/eslint-config-react-native": "3.3.3",
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "^29.5.12",
"@types/react": "~18.3.18",
"babel-plugin-transform-remove-console": "^6.9.4",
Expand All @@ -61,7 +62,7 @@
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-expo": "^52.0.2",
"jest-expo": "^52.0.6",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"release-it": "^17.4.1",
Expand Down
Loading
Loading