-
Update the
version
field inpackage.json
(note that it must be semantically greater than all previous versions), commit, and push -
Go to https://bitrise.io
-
If you are deploying to production, click on the
brave-alert-app
AppIf you are deploying to staging, click on the
brave-alert-app-brave1
App -
Click "Start/Schedule a Build"
-
[Optional] Change the branch that you want to deploy (by default, the
production
branch is used for production and themain
branch is used for staging) -
If you are deploying to iOS, select the Workflow "deploy-ios"
If you are deploying to Android, select the Workflow "deploy-android"
and click "Start Build"
-
Once the "deploy-android" build is complete:
-
TODO: Add instructions on how to have this release reviewed
-
Once the "deploy-ios" build is complete:
-
If you are deploying to production, select the "Alert App" App
If you are deploying to staging, select the "B1 Brave Alert" App
-
Click "Test Flight"
-
Expand the newest version
-
Click on the "Manage" link in the Status "Missing Compliance Manage"
-
This app uses HTTPS, so answer "Yes" to "Does your app use encryption?"
-
Answer "No" for all subsequent questions
-
"Does your app qualify for any of the exemptions provided in Category 5, Part 2 of the U.S. Export Administration Regulations?"
-
"Does your app implement any encryption algorithms that are proprietary or not accepted as standards by international standard bodies (IEEE, IETF, ITU, etc.)?"
-
"Does your app implement any standard encryption algorithms instead of, or in addition to, using or accessing the encryption within Apple’s operating system?"
-
-
Click "Start Internal Testing"
-
-
TODO: Add instructions on how to have this release reviewed
-
Install your Android development environment by following the React Native CLI Quickstart instructions
-
Add the environment variable FONTAWESOME_NPM_AUTH_TOKEN. One way to do this is to include the following in your
.zshrc
file and restarting your terminal.export FONTAWESOME_NPM_AUTH_TOKEN=<value from 1Password>
On Windows machines the following command works for the duration of the terminal session:
$env:FONTAWESOME_NPM_AUTH_TOKEN = '<value from 1Password>'
-
In the project root directory, install/update dependencies:
npm install
-
Open your Android emulator
- Open Android Studio
- Click "Configure" --> "AVD Manager"
- Push the Play arrow in the "Actions" column of the emulator you want to use
-
Run it
npm run android
_ Note _ This will only work on a Mac.
-
Install your iOS development environment by following the React Native CLI Quickstart instructions
-
Add the environment variable FONTAWESOME_NPM_AUTH_TOKEN. One way to do this is to include the following in your
.zshrc
file and restarting your terminal.export FONTAWESOME_NPM_AUTH_TOKEN=<value from 1Password>
-
In the project root directory, install/update dependencies:
npm install
-
Run it
npm run ios
- Follow the instructions on https://reactnative.dev/docs/running-on-device for your OS and the target device. Note: you need a Mac in order to run on an iOS device.
-
npm test
-
npm run lint
-
If you are on a Mac, set
STORYBOOK_HOST
to your local IP address in.env
. For exampleSTORYBOOK_HOST=192.168.0.33
-
To open Storybook in your browser
-
If you're on a Mac, run
STORYBOOK_HOST=<your local IP address> npm run storybook
-
Otherwise, run
npm run storybook
Note that the components will not appear until after the device has connected.
-
-
Open the app, run
npm run android
OR
npm run ios
-
Open the developer menu by shaking the device or by pressing Command-M on a Mac.
-
Click "Toggle Storybook".
-
Wait for the components to appear in the browser.
Reference: https://docs.travis-ci.com/user/environment-variables/#encrypting-environment-variables
-
Download the Travis CLI
gem install travis
-
cd to anywhere in this repo
-
temporarily create a personal access token on GitHub https://github.com/settings/tokens with the following permissions:
repo
read:packages
read:org
read:public_key
read:repo_hook
user
read:discussion
read:enterprise
-
login using
travis login --pro --github-token <token from github>
-
For a given
VAR_NAME
that you want to have valuesecret_value
, runtravis encrypt --pro VAR_NAME=secret_value
which will ask for your GitHub username and password and then output your encrypted variable -
Copy the encrypted variable into
.travis.yml
-
Delete your personal access token from GitHub
android/
- Native code for Android. I don't think that we will ever need to edit this directly.ios/
- Native code for iOS. I don't think that we will never need to edit this directly.node_modules/
- Dependency code generated by NPM. Do not edit this directly.src/
components/
- UI components and their stories.hooks/
- React Hooks.mocks/
- React Native module mocks used for testing.navigation/
- React Navigation configuration.redux/
- React-Redux configuration. This controls the app's state by keeping it in the store and using reducers for state changes.resources/
- Static app assets.images/
- Image files used in the app.colors.js
- Module for accessing the colours that we use across the app.images.js
- Module for accessing the images.
screens/
- App screens that are made up of components and are navigated between using React Navigation.services/
- The service layer of the application, where processing gets done.errors/
- Errors that can come up while using the services.
storybook/
- Code to make the Storybook UI interface work.index.js
sometimes needs tweaking, but the rest of these files will probably never been edited.test
- Unit tests. Structure within this folder should match the rest of the file structure.
.env.example
- An example.env
file that can be copied and modified to work in the different environments..eslintignore
- Used so that ESLint doesn't look in the/storybook
directory..eslintrc.json
- ESLint configuration..gitignore
- Files that shouldn't be checked into git..nvmrc
- Specifies the exact version of Node to be used on Travis..travis.yml
- Travis CI configuration.app.json
- I'm not sure.babel.config.js
- I'm not sure.bitrise.yml
- Configuration for our BitRise deployment pipelines.CHANGELOG.md
- The changelog.index.js
- Entrypoint into the app.LICENSE
- Our open source license.metro.config.js
- Metro JS bundler configuration.package.json
- NPM package definition.package-lock.json
- NPM package description. This is auto-generated and should not be edited directly.README.md
- The README.
-
Create a new Bundle ID
-
Go to https://developer.apple.com/account/resources/identifiers/list
-
Click on the "+" button beside "Identifiers"
-
Select "App IDs" and click "Continue"
-
Select "App" and click "Continue"
-
In "Description" provide a short description. In "Bundle ID" provide your new bundle ID (for example
coop.brave.example.bundleid
). Under "Capabilities" select "App Groups" and "Push Notifications". Click "Continue" -
Review the information and click "Register"
-
-
Create a new Bundle ID for the OneSignalNotificationService
-
Go to https://developer.apple.com/account/resources/identifiers/list
-
Click on the "+" button beside "Identifiers"
-
Select "App IDs" and click "Continue"
-
Select "App" and click "Continue"
-
In "Description" provide a short description. In "Bundle ID" provide the same Bundle ID from the previous step with
.OneSignalNotificationServiceExtension
appended to it (for examplecoop.brave.example.bundleid.OneSignalNotificationServiceExtension
). Under "Capabilities" select "App Groups". Click "Continue" -
Review the information and click "Register"
-
-
Create a new App
-
Click on the "+" button beside "Apps" and click "New App"
-
Under "Platforms", select "iOS"
-
Under "Name", provide a name for the app
-
Under "Primary language", select a primary language for the app
-
Under "Bundle ID", select the Bundle ID that you created above
-
Under "SKU", provide the same value as your Bundle ID
-
Under "User Access", select "Full Access"
-
Click "Create"
-
Create a provisioning profile
-
Go to https://developer.apple.com/account/resources/profiles/list
-
Click on the "+" button beside "Profiles"
-
Select "App Store" and click "Continue"
-
Select the app's Bundle ID from the dropdown list (for example:
coop.brave.example.bundleid
) and click "Continue" -
Select the iOS Distribution certificate that you plan to use for the app
-
Give the profile a name and click "Generate"
-
Download the profile by clicking "Download"
-
-
Create a provisioning profile for the OneSignalNotificationService
-
Go to https://developer.apple.com/account/resources/profiles/list
-
Click on the "+" button beside "Profiles"
-
Select "App Store" and click "Continue"
-
Select the OneSignalNotificationService's Bundle ID from the dropdown list (for example:
coop.brave.example.bundleid.OneSignalNotificationService
) and click "Continue" -
Select the iOS Distribution certificate that you plan to use for the app (should be the same as the previous step)
-
Give the profile a name and click "Generate"
-
-
Create a Push Notification Certificate for iOS
-
For security reasons, change your Apple ID password
-
Use the OneSignal Push Notifications Certificate Wizard: https://onesignal.com/provisionator to add your Push Notification Certificate and generate a .p12 certificate file (and password)
-
Save the resulting .p12 file and its password in 1password --> "Brave Alert App" vault
-
For security reasons, change your Apple ID password again and sign out of all other devices
-
Go to https://developer.apple.com/account/resources/profiles/list and you will see that your two provisioning profiles have the expiration "Invalid". To validate them, they just needs to be re-saved by doing the following for each of the two provisioning profiles
-
Click on the profile
-
Click "Edit"
-
Click "Save"
-
-
-
Set up a Firebase project using these instructions: https://documentation.onesignal.com/docs/generate-a-google-server-api-key
-
Create a new project in OneSignal (https://app.onesignal.com/)
-
Pick a name for the project, choose to set up the iOS platform, click "Next"
-
Upload the .p12 certificate generated in the first step to OneSignal as described here: https://documentation.onesignal.com/docs/generate-an-ios-push-certificate#step-3-upload-your-push-certificate-to-onesignal , click "Save & Continue"
-
Choose "React Native / Expo" as your target SDK, click "Save & Continue"
-
Click "Done"
-
Select "Google Android"
-
Add the Firebase Server Key and Sender ID from Firebase following these instructions: https://documentation.onesignal.com/docs/generate-a-google-server-api-key#step-2-getting-your-firebase-cloud-messaging-token-and-sender-id , click "Save & Continue"
-
Choose "React Native / Expo" as your target SDK, click "Save & Continue"
-
Click "Done"
-
-
Select an owner
-
Under "Choose Account", select "Brave Technology Coop"
-
Under "Set Privacy of the App", select "Private"
-
Click "Next"
-
-
Choose a repo
-
Click on "Other/Manual"
-
Under "Git repository (clone) URL", put "git@github.com:bravetechnologycoop/brave-alert-app.git"
-
Click "Next"
-
-
Setup repository access
-
Click "Add own SSH"
-
Copy the RSA SSH private key for GitHub from 1Password --> Brave Alert App --> "Alert App GitHub Private SSH Deploy Key (for BitRise)" and paste into the textbox
-
Click "All done"
-
-
Choose branch
-
Select the default branch for the deployments. Note that this branch must have a
bitrise.yml
file in its root -
Click "Next"
-
-
Wait for the project scanner to finish
-
It should recognize it as a React Native project
-
The "Specify module" textbox should be autofilled with "app"
-
Click "Next"
-
In the "Specify Variant" textbox, put "all"
-
Click "Next"
-
The "Project or Workspace path" should automatically select "ios/BraveAlertApp.xcworkspace"
-
The "Scheme name" should automatically select "BraveAlertApp"
-
For "Select ipa export method", choose "app-store"
-
If everything looks good, click "Confirm"
-
-
App icon
- Click "Skip for Now"
-
Webhook setup
- Click "Skip the Webhook registration"
-
It will automatically kick off a build for you. This build will fail because the Secrets haven't been set yet
-
Navigate to your newly created BitRise App
-
For some reason, it didn't use the
bitrise.yml
in my project, so to fix that-
Navigate to Workflow --> bitrise.yml
-
Click "Store in app repository"
-
Click "Update settings"
-
Click "Continue"
-
-
Add Secrets
-
Navigate to your app --> Workflow --> Secrets. Add the following values
-
FONTAWESOME_NPM_AUTH_TOKEN
: get value from 1Password --> Shared --> FontAwesome --> Pro NPM Package Token -
SENTRY_AUTH_TOKEN
: get value from https://sentry.io/settings/account/api/auth-tokens/ -
SENTRY_DSN
: get value from https://sentry.io/settings/brave-technology-coop/projects/brave-alert-app/keys/ -
SENTRY_ENV
: the Sentry environment that you want to use for all errors sent to Sentry from apps built through these BitRise workflows. For example "production" -
TEAM
: get value from https://developer.apple.com/account/#/membership -
CODE_SIGNING_IDENTITY
: value should beiPhone Distribution: Brave Technology Coop ($TEAM)
-
ALERT_APP_PROVISIONING_PROFILE_SPECIFIER
: get the name of the environment's Alert App provisioning profile from https://developer.apple.com/account/resources/profiles/list -
ONESIGNAL_PROVISIONING_PROFILE_SPECIFIER
: get the name of the environment's OneSignal Notification Service provisioning profile from https://developer.apple.com/account/resources/profiles/list -
CF_BUNDLE_IDENTIFIER
: get value from https://appstoreconnect.apple.com/apps --> your app --> App Store --> App Information --> General Information --> Bundle ID -
CF_ONESIGNAL_BUNDLE_IDENTIFIER
: get value from 'IDENTIFIER' column on https://developer.apple.com/account/resources/identifiers/list for the environment's OneSignal Notification Service -
CF_BUNDLE_DISPLAY_NAME
: seems like this can be anything. I'm not sure what it's used for -
SENSOR_BASE_URL
: the base URL for API calls to the Sensor server (do not includehttps://
) and with no slash at the end, for examplebrave-sensor.com
-
BUTTONS_BASE_URL
: the base URL for API calls to the Buttons server (do not includehttps://
) and with no slash at the end, for examplebrave-buttons.com
-
BUNDLE_ID
: get value from https://play.google.com/console/u/0/developers . Look at the string immediately below the name of your Android app in the list of apps, for examplecoop.brave.example.bundleid
-
CONTACT_FORM_URI
: get by following the instructions in.env.test
-
CONTACT_FORM_NAME_QUESTION_ID
: get by following the instructions in.env.test
-
CONTACT_FORM_ORG_QUESTION_ID
: get by following the instructions in.env.test
-
CONTACT_FORM_MESSAGE_QUESTION_ID
: get by following the instructions in.env.test
-
CONTACT_FORM_CONTACT_METHOD_QUESTION_ID
: get by following the instructions in.env.test
-
ONESIGNAL_APP_ID
: get value from https://app.onesignal.com/ --> Settings --> Keys & IDs --> OneSignal App ID
-
-
-
Add Code Signing
-
Navigate to your app --> Workflow --> Code Signing
-
Upload your two iOS provisioning profiles (one for the app and the other for the OneSignalNotificationService) (get them from https://developer.apple.com/account/resources/profiles/list). You will see an error message saying that the profile doesn't match the certificate
-
Upload your iOS Code Signing Certificate
-
Download your certificate from https://developer.apple.com/account/resources/certificates/list . Note that this must be the same certificate used when the iOS provisioning profile was created
-
Follow instructions at https://calvium.com/how-to-make-a-p12-file/ starting at STEP 3 to create the corresponding .p12 file. Please put a password!
-
Upload the file and add its password. You should see the provisioning profile error message disappear
-
-
Upload Android Keystore File
-
Create an Android Keystore File following the instructions here: https://developer.android.com/studio/publish/app-signing#generate-key
-
Upload the genereated keystore file
-
Enter the keystore password, the keystore alias, and the key password
-
Click "Save metadata"
-
Click "OK"
-
-
Upload Service Account JSON Key
-
Under "File Storage ID", type "SERVICE_ACCOUNT_JSON_KEY"
-
Upload the Google Service ID. Get this file from 1Password --> Brave Alert App --> Android service account key (Brave Alert App)
-
-
-
Update the default Stack
-
Navigate to your app --> Workflow --> Stack
-
Under "Default Stack", select "Xcode 12.3.x, on macOS 10.15.6 (Catalina)"
-
Click "Save"
-
-
Add your Apple Service Connection
-
Navigate to your app --> Team
-
In the "Apple Service connection" section, under "API key authentication (recommended)", select "Brave"
-
-
Generate your first Android APK
-
Navigate to your app
-
Click on "Start/Schedule a Build"
-
Under "Workflow", select "deploy-android"
-
Click "Start Build"
-
Wait for it to successfully finish the "Deploy to Bitrise.io - Apps, Logs, Artifacts" step (Note that it will have failed on the "Google Play Deploy" step. This is normal and expected)
-
-
Create new App
-
Click on "Create app"
-
Under "App name" provide a name for the app
-
Under "Default language", select a default language for the app
-
Under "App or game", select "App"
-
Under "Free or paid", select "Free"
-
Under "Declarations", check the boxes
-
Click "Create app"
-
From the Dashboard, under "Start testing now",
-
Click "View tasks"
-
Click "Select testers"
-
Select your testers
-
Click "Save changes"
-
Click "Create a new release"
-
Click "Manage app signing"
-
Select "Opt out of Play App Signing"
-
Click "Update"
-
Click "Opt out"
-
Download your first APK from BitRise
-
Open the first build of the "deploy-android" workflow that successfully completed the "Deploy to Bitrise.io - Apps, Logs, Artifacts" step (Note that it will have failed on the "Google Play Deploy" step. This is normal and expected)
-
Click on "Apps & Artifacts"
-
Download the "app-release-bitrise-signed.apk" file
-
Under "App bundles and APKs", upload the APK that you just downloaded
-
Under "Release name", give your release a name
-
Under "Release notes", give your release some notes
-
Click "Save"
-
Click "Review Release"
-
Click "Start rollout to Internal testing"
-
Click "Rollout"
-
-
From the Dashboard, under "Set up your app"
-
Click "View Tasks"
-
Complete all the tasks
-