Skip to content

Commit

Permalink
Step Inititialization (#2)
Browse files Browse the repository at this point in the history
## Basics
This step uses the [expo-cli](https://docs.expo.io/versions/latest/introduction/installation#local-development-tool-expo-cli) to create Xcode and Android Studio projects for your app.

## Eject Method
- If you use any Expo SDK you must to provide username and password for your Expo account.
Because in this case, the expo-cli will use the expoKit eject method which needs an account.

- If your project does not import any Expo SDK then you should not use the username/password option.
Because in this case, the expo-cli will use the plain eject method.
  • Loading branch information
BirmacherAkos authored Sep 24, 2018
1 parent 8732d35 commit a8d1eb1
Show file tree
Hide file tree
Showing 25 changed files with 2,048 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.bitrise*
_tmp
37 changes: 37 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[constraint]]
branch = "master"
name = "github.com/bitrise-io/go-utils"

[[constraint]]
branch = "master"
name = "github.com/bitrise-tools/go-steputils"

[prune]
go-tests = true
unused-packages = true
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# [Beta] Expo Detach

Using the The Expo Development CLI to Creates Xcode and Android Studio projects for your app.


## How to use this Step

Can be run directly with the [bitrise CLI](https://github.com/bitrise-io/bitrise),
just `git clone` this repository, `cd` into it's folder in your Terminal/Command Line
and call `bitrise run test`.

*Check the `bitrise.yml` file for required inputs which have to be
added to your `.bitrise.secrets.yml` file!*

Step by step:

1. Open up your Terminal / Command Line
2. `git clone` the repository
3. `cd` into the directory of the step (the one you just `git clone`d)
5. Create a `.bitrise.secrets.yml` file in the same directory of `bitrise.yml`
(the `.bitrise.secrets.yml` is a git ignored file, you can store your secrets in it)
6. Check the `bitrise.yml` file for any secret you should set in `.bitrise.secrets.yml`
* Best practice is to mark these options with something like `# define these in your .bitrise.secrets.yml`, in the `app:envs` section.
7. Once you have all the required secret parameters in your `.bitrise.secrets.yml` you can just run this step with the [bitrise CLI](https://github.com/bitrise-io/bitrise): `bitrise run test`

An example `.bitrise.secrets.yml` file:

```
envs:
- A_SECRET_PARAM_ONE: the value for secret one
- A_SECRET_PARAM_TWO: the value for secret two
```

## How to create your own step

1. Create a new git repository for your step (**don't fork** the *step template*, create a *new* repository)
2. Copy the [step template](https://github.com/bitrise-steplib/step-template) files into your repository
3. Fill the `step.sh` with your functionality
4. Wire out your inputs to `step.yml` (`inputs` section)
5. Fill out the other parts of the `step.yml` too
6. Provide test values for the inputs in the `bitrise.yml`
7. Run your step with `bitrise run test` - if it works, you're ready

__For Step development guidelines & best practices__ check this documentation: [https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md](https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md).

**NOTE:**

If you want to use your step in your project's `bitrise.yml`:

1. git push the step into it's repository
2. reference it in your `bitrise.yml` with the `git::PUBLIC-GIT-CLONE-URL@BRANCH` step reference style:

```
- git::https://github.com/user/my-step.git@branch:
title: My step
inputs:
- my_input_1: "my value 1"
- my_input_2: "my value 2"
```

You can find more examples of step reference styles
in the [bitrise CLI repository](https://github.com/bitrise-io/bitrise/blob/master/_examples/tutorials/steps-and-workflows/bitrise.yml#L65).

## How to contribute to this Step

1. Fork this repository
2. `git clone` it
3. Create a branch you'll work on
4. To use/test the step just follow the **How to use this Step** section
5. Do the changes you want to
6. Run/test the step before sending your contribution
* You can also test the step in your `bitrise` project, either on your Mac or on [bitrise.io](https://www.bitrise.io)
* You just have to replace the step ID in your project's `bitrise.yml` with either a relative path, or with a git URL format
* (relative) path format: instead of `- original-step-id:` use `- path::./relative/path/of/script/on/your/Mac:`
* direct git URL format: instead of `- original-step-id:` use `- git::https://github.com/user/step.git@branch:`
* You can find more example of alternative step referencing at: https://github.com/bitrise-io/bitrise/blob/master/_examples/tutorials/steps-and-workflows/bitrise.yml
7. Once you're done just commit your changes & create a Pull Request


## Share your own Step

You can share your Step or step version with the [bitrise CLI](https://github.com/bitrise-io/bitrise). If you use the `bitrise.yml` included in this repository, all you have to do is:

1. In your Terminal / Command Line `cd` into this directory (where the `bitrise.yml` of the step is located)
1. Run: `bitrise run test` to test the step
1. Run: `bitrise run audit-this-step` to audit the `step.yml`
1. Check the `share-this-step` workflow in the `bitrise.yml`, and fill out the
`envs` if you haven't done so already (don't forget to bump the version number if this is an update
of your step!)
1. Then run: `bitrise run share-this-step` to share the step (version) you specified in the `envs`
1. Send the Pull Request, as described in the logs of `bitrise run share-this-step`

That's all ;)

## Trigger a new release

- __merge every code changes__ to the `master` branch
- __push the new version tag__ to the `master` branch
142 changes: 142 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
format_version: 5
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
envs:
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/bitrise-steplib/steps-expo-detach.git

# Define it in .bitrise.secrets.yml
- USER_NAME: $USER_NAME
- PASSWORD: $PASSWORD

workflows:
test:
envs:
- ORIGIN_SOURCE_DIR: $BITRISE_SOURCE_DIR
- SAMPLE_APP_URL: https://github.com/bitrise-samples/react-native-expo.git
before_run:
- audit-this-step
steps:
- go-list:
- golint:
- errcheck:
- go-test:
after_run:
- plain
- expo_kit
- plain_2_0_0
- expo_kit_2_0_0

plain:
before_run:
- _clear_workdir
steps:
- script:
title: Clone sample app
inputs:
- content: git clone $SAMPLE_APP_URL . && cd
- [email protected]:
title: Install node modules for the expo project
inputs:
- command: install
- path::./:
title: Step Test
run_if: true
inputs:
- project_path: $BITRISE_SOURCE_DIR
- expo_cli_verson: "latest"

plain_2_0_0:
before_run:
- _clear_workdir
steps:
- script:
title: Clone sample app
inputs:
- content: git clone $SAMPLE_APP_URL . && cd
- [email protected]:
title: Install node modules for the expo project
inputs:
- command: install
- path::./:
title: Step Test
run_if: true
inputs:
- project_path: $BITRISE_SOURCE_DIR
- expo_cli_verson: "2.0.0"

expo_kit:
before_run:
- _clear_workdir
steps:
- script:
title: Clone sample app
inputs:
- content: git clone -b expo_sdk $SAMPLE_APP_URL . && cd
- [email protected]:
title: Install node modules for the expo project
inputs:
- command: install
- path::./:
title: Step Test
run_if: true
inputs:
- project_path: $BITRISE_SOURCE_DIR
- expo_cli_verson: "latest"
- user_name: $USER_NAME
- password: $PASSWORD

expo_kit_2_0_0:
before_run:
- _clear_workdir
steps:
- script:
title: Clone sample app
inputs:
- content: git clone -b expo_sdk $SAMPLE_APP_URL . && cd
- [email protected]:
title: Install node modules for the expo project
inputs:
- command: install
- path::./:
title: Step Test
run_if: true
inputs:
- project_path: $BITRISE_SOURCE_DIR
- expo_cli_verson: "2.0.0"
- user_name: $USER_NAME
- password: $PASSWORD

_clear_workdir:
envs:
steps:
- script:
inputs:
- content: |-
#!/bin/bash
set -ex
cd ${ORIGIN_SOURCE_DIR}
rm -rf "./_tmp"
mkdir "_tmp"
- change-workdir:
title: Switch working dir to test / _tmp dir
description: |-
To prevent step testing issues, like referencing relative
files with just './some-file' in the step's code, which would
work for testing the step from this directory directly
but would break if the step is included in another `bitrise.yml`.
run_if: true
inputs:
- path: ${ORIGIN_SOURCE_DIR}/_tmp
- is_create_path: true

# ----------------------------------------------------------------
# --- workflows to Share this step into a Step Library
audit-this-step:
steps:
- script:
inputs:
- content: |-
#!/bin/bash
set -ex
stepman audit --step-yml ./step.yml
Loading

0 comments on commit a8d1eb1

Please sign in to comment.