Skip to content

Commit a30c315

Browse files
committed
Initial commit
0 parents  commit a30c315

File tree

6 files changed

+325
-0
lines changed

6 files changed

+325
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.bitrise*
2+
.gows.user.yml

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Sinan Gunes
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Firebase App Distribution
2+
3+
Upload your app binaries to Firebase and sends email to your testers.
4+
5+
6+
## How to use this Step
7+
8+
Can be run directly with the [bitrise CLI](https://github.com/bitrise-io/bitrise),
9+
just `git clone` this repository, `cd` into it's folder in your Terminal/Command Line
10+
and call `bitrise run test`.
11+
12+
*Check the `bitrise.yml` file for required inputs which have to be
13+
added to your `.bitrise.secrets.yml` file!*
14+
15+
Step by step:
16+
17+
1. Open up your Terminal / Command Line
18+
2. `git clone` the repository
19+
3. `cd` into the directory of the step (the one you just `git clone`d)
20+
5. Create a `.bitrise.secrets.yml` file in the same directory of `bitrise.yml`
21+
(the `.bitrise.secrets.yml` is a git ignored file, you can store your secrets in it)
22+
6. Check the `bitrise.yml` file for any secret you should set in `.bitrise.secrets.yml`
23+
* Best practice is to mark these options with something like `# define these in your .bitrise.secrets.yml`, in the `app:envs` section.
24+
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`
25+
26+
An example `.bitrise.secrets.yml` file:
27+
28+
```
29+
envs:
30+
- A_SECRET_PARAM_ONE: the value for secret one
31+
- A_SECRET_PARAM_TWO: the value for secret two
32+
```
33+
34+
## How to create your own step
35+
36+
1. Create a new git repository for your step (**don't fork** the *step template*, create a *new* repository)
37+
2. Copy the [step template](https://github.com/bitrise-steplib/step-template) files into your repository
38+
3. Fill the `step.sh` with your functionality
39+
4. Wire out your inputs to `step.yml` (`inputs` section)
40+
5. Fill out the other parts of the `step.yml` too
41+
6. Provide test values for the inputs in the `bitrise.yml`
42+
7. Run your step with `bitrise run test` - if it works, you're ready
43+
44+
__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).
45+
46+
**NOTE:**
47+
48+
If you want to use your step in your project's `bitrise.yml`:
49+
50+
1. git push the step into it's repository
51+
2. reference it in your `bitrise.yml` with the `git::PUBLIC-GIT-CLONE-URL@BRANCH` step reference style:
52+
53+
```
54+
- git::https://github.com/user/my-step.git@branch:
55+
title: My step
56+
inputs:
57+
- my_input_1: "my value 1"
58+
- my_input_2: "my value 2"
59+
```
60+
61+
You can find more examples of step reference styles
62+
in the [bitrise CLI repository](https://github.com/bitrise-io/bitrise/blob/master/_examples/tutorials/steps-and-workflows/bitrise.yml#L65).
63+
64+
## How to contribute to this Step
65+
66+
1. Fork this repository
67+
2. `git clone` it
68+
3. Create a branch you'll work on
69+
4. To use/test the step just follow the **How to use this Step** section
70+
5. Do the changes you want to
71+
6. Run/test the step before sending your contribution
72+
* You can also test the step in your `bitrise` project, either on your Mac or on [bitrise.io](https://www.bitrise.io)
73+
* 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
74+
* (relative) path format: instead of `- original-step-id:` use `- path::./relative/path/of/script/on/your/Mac:`
75+
* direct git URL format: instead of `- original-step-id:` use `- git::https://github.com/user/step.git@branch:`
76+
* 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
77+
7. Once you're done just commit your changes & create a Pull Request
78+
79+
80+
## Share your own Step
81+
82+
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:
83+
84+
1. In your Terminal / Command Line `cd` into this directory (where the `bitrise.yml` of the step is located)
85+
1. Run: `bitrise run test` to test the step
86+
1. Run: `bitrise run audit-this-step` to audit the `step.yml`
87+
1. Check the `share-this-step` workflow in the `bitrise.yml`, and fill out the
88+
`envs` if you haven't done so already (don't forget to bump the version number if this is an update
89+
of your step!)
90+
1. Then run: `bitrise run share-this-step` to share the step (version) you specified in the `envs`
91+
1. Send the Pull Request, as described in the logs of `bitrise run share-this-step`
92+
93+
That's all ;)

bitrise.yml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
format_version: 4
2+
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
3+
4+
app:
5+
envs:
6+
# An example secret param, define it (A_SECRET_PARAM) in .bitrise.secrets.yml
7+
- A_SECRET_PARAM: $A_SECRET_PARAM
8+
# If you want to share this step into a StepLib
9+
- BITRISE_STEP_ID: firebase-app-distribution
10+
- BITRISE_STEP_VERSION: "0.0.1"
11+
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/guness/bitrise-step-firebase-app-distribution.git
12+
- MY_STEPLIB_REPO_FORK_GIT_URL: $MY_STEPLIB_REPO_FORK_GIT_URL
13+
14+
workflows:
15+
test:
16+
steps:
17+
- script:
18+
inputs:
19+
- content: |
20+
#!/bin/bash
21+
echo "Just an example 'secrets' print."
22+
echo "The value of 'A_SECRET_PARAM' is: $A_SECRET_PARAM"
23+
- change-workdir:
24+
title: Switch working dir to test / _tmp dir
25+
description: |-
26+
To prevent step testing issues, like referencing relative
27+
files with just './some-file' in the step's code, which would
28+
work for testing the step from this directory directly
29+
but would break if the step is included in another `bitrise.yml`.
30+
run_if: true
31+
inputs:
32+
- path: ./_tmp
33+
- is_create_path: true
34+
- path::./:
35+
title: Step Test
36+
description: |-
37+
The example input has a default value,
38+
you can overwrite it if you want to, just like we did below,
39+
but the step would use the default value specified in the `step.yml`
40+
file if you would not specify another value.
41+
run_if: true
42+
inputs:
43+
- example_step_input: Example Step Input's value
44+
- script:
45+
inputs:
46+
- content: |
47+
#!/bin/bash
48+
echo "This output was generated by the Step (EXAMPLE_STEP_OUTPUT): $EXAMPLE_STEP_OUTPUT"
49+
50+
51+
# ----------------------------------------------------------------
52+
# --- workflows to Share this step into a Step Library
53+
audit-this-step:
54+
steps:
55+
- script:
56+
inputs:
57+
- content: |-
58+
#!/bin/bash
59+
set -ex
60+
stepman audit --step-yml ./step.yml
61+
62+
share-this-step:
63+
envs:
64+
# if you want to share this step into a StepLib
65+
- MY_STEPLIB_REPO_FORK_GIT_URL: $MY_STEPLIB_REPO_FORK_GIT_URL
66+
- BITRISE_STEP_ID: $BITRISE_STEP_ID
67+
- BITRISE_STEP_VERSION: $BITRISE_STEP_VERSION
68+
- BITRISE_STEP_GIT_CLONE_URL: $BITRISE_STEP_GIT_CLONE_URL
69+
description: |-
70+
If this is the first time you try to share a Step you should
71+
first call: $ bitrise share
72+
73+
This will print you a guide, and information about how Step sharing
74+
works. Please read it at least once!
75+
76+
As noted in the Step sharing guide you'll have to fork the
77+
StepLib you want to share this step into. Once you're done with forking
78+
the repository you should set your own fork's git clone URL
79+
in the `.bitrise.secrets.yml` file, or here in the `envs` section,
80+
as the value of the `MY_STEPLIB_REPO_FORK_GIT_URL` environment.
81+
82+
You're now ready to share this Step, just make sure that
83+
the `BITRISE_STEP_ID` and `BITRISE_STEP_VERSION`
84+
environments are set to the desired values!
85+
86+
To share this Step into a StepLib you can just run: $ bitrise run share-this-step
87+
88+
Once it finishes the only thing left is to actually create a Pull Request,
89+
the way described in the guide printed at the end of the process.
90+
before_run:
91+
- audit-this-step
92+
steps:
93+
- script:
94+
inputs:
95+
- content: |-
96+
#!/bin/bash
97+
set -ex
98+
bitrise share start -c "${MY_STEPLIB_REPO_FORK_GIT_URL}"
99+
bitrise share create --stepid "${BITRISE_STEP_ID}" --tag "${BITRISE_STEP_VERSION}" --git "${BITRISE_STEP_GIT_CLONE_URL}"
100+
bitrise share finish

step.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
echo "This is the value specified for the input 'example_step_input': ${example_step_input}"
5+
6+
#
7+
# --- Export Environment Variables for other Steps:
8+
# You can export Environment Variables for other Steps with
9+
# envman, which is automatically installed by `bitrise setup`.
10+
# A very simple example:
11+
envman add --key EXAMPLE_STEP_OUTPUT --value 'the value you want to share'
12+
# Envman can handle piped inputs, which is useful if the text you want to
13+
# share is complex and you don't want to deal with proper bash escaping:
14+
# cat file_with_complex_input | envman add --KEY EXAMPLE_STEP_OUTPUT
15+
# You can find more usage examples on envman's GitHub page
16+
# at: https://github.com/bitrise-io/envman
17+
18+
#
19+
# --- Exit codes:
20+
# The exit code of your Step is very important. If you return
21+
# with a 0 exit code `bitrise` will register your Step as "successful".
22+
# Any non zero exit code will be registered as "failed" by `bitrise`.

step.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#
2+
# A couple of useful guides & docs:
3+
#
4+
# - Main Bitrise CLI docs: https://github.com/bitrise-io/bitrise/tree/master/_docs
5+
# - Step Development Guideline: https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md
6+
# - Bitrise.yml format spec: https://github.com/bitrise-io/bitrise/blob/master/_docs/bitrise-yml-format-spec.md
7+
# - Bitrise docs: http://devcenter.bitrise.io/
8+
# - Bitrise CLI guides: http://devcenter.bitrise.io/bitrise-cli/
9+
10+
title: |-
11+
[Alpha]Firebase App Distribution
12+
summary: |
13+
[Alpha]Distributes your builds via Firebase App Distribution
14+
description: |
15+
[Alpha]Upload your app binaries to Firebase and sends email to your testers.
16+
website: https://github.com/guness/bitrise-step-firebase-app-distribution
17+
source_code_url: https://github.com/guness/bitrise-step-firebase-app-distribution
18+
support_url: https://github.com/guness/bitrise-step-firebase-app-distribution
19+
host_os_tags:
20+
- osx-10.10
21+
- ubuntu-16.04
22+
23+
# If this step should be available only for certain project types
24+
# just uncomment this `project_type_tags` section and include all the
25+
# project types supported by the step. If the step can be used for all
26+
# project types then you can just remove this section.
27+
# If no `project_type_tags` specified (or specified as an empty array)
28+
# that means the step can be used for any project type.
29+
# You can find more information about project type tags in the Step Development Guideline:
30+
# https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md
31+
#
32+
# project_type_tags:
33+
# - ios
34+
# - macos
35+
# - android
36+
# - xamarin
37+
# - react-native
38+
# - cordova
39+
# - ionic
40+
41+
# Type tags are used for categorizing steps, for easier step discovery in Step Libraries.
42+
# You can find more information about type tags in the Step Development Guideline:
43+
# https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md
44+
type_tags:
45+
- deploy
46+
47+
is_requires_admin_user: true
48+
is_always_run: false
49+
is_skippable: false
50+
run_if: ""
51+
52+
deps:
53+
brew:
54+
- name: git
55+
- name: wget
56+
apt_get:
57+
- name: git
58+
- name: wget
59+
60+
61+
toolkit:
62+
bash:
63+
entry_file: step.sh
64+
65+
66+
inputs:
67+
- example_step_input: Default Value - you can leave this empty if you want to
68+
opts:
69+
title: "Example Step Input"
70+
summary: Summary. No more than 2-3 sentences.
71+
description: |
72+
Description of this input.
73+
74+
Can be Markdown formatted text.
75+
is_expand: true
76+
is_required: true
77+
value_options: []
78+
79+
outputs:
80+
- EXAMPLE_STEP_OUTPUT:
81+
opts:
82+
title: "Example Step Output"
83+
summary: Summary. No more than 2-3 sentences.
84+
description: |
85+
Description of this output.
86+
87+
Can be Markdown formatted text.

0 commit comments

Comments
 (0)