> For the complete documentation index, see [llms.txt](https://bamtech.gitbook.io/dev-standards/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bamtech.gitbook.io/dev-standards/react-native/setup/setup-and-deploy-new-project-to-staging-with-hockeyapp.mo.md).

# setup-and-deploy-new-project-to-staging-with-hockeyapp.mo

{% hint style="danger" %}
**DEPRECATION**

This standard has been deprecated by [@felixmeziere](https://github.com/felixmeziere) on January 28 in favour of [\[MO\] Deploy to staging](/dev-standards/react-native/setup/setup-and-deploy-new-project-to-staging.mo.md).

**Reason**: HockeyApp is meant to be deprecated by AppCenter. AppCenter is the new HockeyApp and there is [no loss of functionality](http://blog.m33.network/2017/09/react-native-devops-2-0-overview-of-mobile-center-next-generation-of-hockeyapp/).
{% endhint %}

## Owner: [Yann Leflour](https://github.com/yleflour)

## Prerequisites

* [ ] Have you entire environment setup
* [ ] Generating a new SSH key and adding it to the ssh-agent: (<https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/>)

## Steps

{% hint style="info" %}
**FRIENDLY ADVICE**

Remember to commit after each step
{% endhint %}

### 1. Setup your React Native App

```bash
react-native init <projectName>
cd <projectName>
# First Commit
```

### 2. Setup Fastlane

```bash
yo rn-toolbox:fastlane-setup
# Second Commit
```

***Answers***

* Please confirm the project name: `<Press Enter>`
* Commit keystore files?: `Y`
* Overwrite : `<Press Enter>`

### 3. Setup Staging Env

```bash
yo rn-toolbox:fastlane-env
# Third Commit
```

***Answers***

* Please confirm the project name: `<Press Enter>`
* The name for this new environment (lowercase, no space): `staging`
* The name of your repository Git branch for the environment just set: `<Press Enter>`
* The name of the company which will be publishing this application: `Bam`
* The app name for this environment: `<AppName> S`
* The App Id for this environment: `tech.bam.<projectname>.staging`
* Which platform will you use for deployment?: `HockeyApp`
* The type of certificate you will be using: `In House (Enterprise only)`
* Your git repo for match: `git@github.com:<TeamRepo>/certificates.git`
* The branch you want to use for match: `<Press Enter>`
* The developer.apple.com team id for the certificates: `**redacted**`
* Your apple id: `**redacted**`
* Your keystore password: `<Press Enter>`
* A valid HockeyApp token: `**redacted**`

### 4. Deploy Staging

```bash
bundle exec fastlane ios deploy --env=staging
bundle exec fastlane android deploy --env=staging
```

### 5. Create the download link

* Go to [smarturl.it](https://manage.smarturl.it)
* Go to Hockey App with `**redacted**`
  * For each app (Android + iOS)
    * Go to `Manage app`
    * Go to `Distribution`
    * Select `Download Page` > `Public`
    * Hit `Save`
* Create a new link
  * Default URl: `Trello url`
  * Device Destination:
    * iPhone: The Hockey App iOS Download & Feedback `Public Page url`
    * iPad: The Hockey App iOS Download & Feedback `Public Page url`
    * Android: The Hockey App iOS Download & Feedback `Public Page url`
  * Organize
    * Custom Alias: `smarturl.it/<projectName>`

## Troubleshooting

If 'Cloning GitHub repo' takes more than 2 minutes: the github servers may be untrusted Trigering a `git clone git@github.com:bamlab/certificates.git` will fix it.
