Skip to content

bitrise-steplib/steps-testfairy-deploy

Repository files navigation

StepTestFairyDeploy

Test run this Step on your own machine

Steps get their inputs through Environment Variables. The Step's inputs are described in the step.yml Step description file.

To run a Step locally you have to define it's inputs (environment variables) before you could run the Step.

A simple way to do this in your Command Line / Terminal is to call it like this:

cd path/to/step/directory

(
	export INPUT_VAR_1="My value 1"
	export INPUT_VAR_2="My value 2"
	...
	bash step.sh
)

Including the environment variable definitions in a (...) block helps to keep your Command Line / Terminal environment clean, those input environments are only available inside the (...) block.

If you plan to test it multiple times you can save this as a shell script and simply call it as many times as you want to.

Create your own Step:

  1. Create a new repository on GitHub
  2. Copy the files from the step-template repository
  3. Commit and push it

Hurray, you just created your first Step repository! You can now start coding and when you're ready you can submit your Step to the Open Step Library.

Step Repository Structure

step.sh

This is the entry point of the Step. A StepLib system will execute this file when it runs the Step. You can run other scripts and programs from step.sh. For example if you want to write your Step in ruby then all you have to include in the step.sh file is the code to run your own ruby script, something like this:

#!/bin/bash

THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

ruby "${THIS_SCRIPT_DIR}/my_ruby_script.rb"
exit $?

inputs: a Step should get it's inputs through environment variables. These inputs can be (and should be) specified in the step.yml description of the Step.

exit code: the exit code generated by step.sh is interpreted as the success/failure code of the whole Step. If it returns 0 the Step will be considered as successful. If it returns with a greater than 0 exit code then the Step is considered to be failed.

step.yml

Description of the step in YAML format.

Specifies information for StepLib users like what platforms the Step supports, what's the official website of the Step, where can a user find the Step's code and where can a user fork the Step.

Also defines an input list for the Step which then can be presented as User Interface for the Step and a StepLib compatible system can interpret these inputs and map the user input values to environment variables which will be available for the Step.

For a full description of the step.yml description file see the documentation on GitHub: https://github.com/steplib/steplib/blob/master/docs/step_format.md

LICENSE

We don't accept steps into the StepLib without a license included in it! Read more about why it's important to have a license file in your open source repository on GitHub: https://github.com/steplib/steplib/blob/master/templates/step/LICENSE.

README.md

Technically README is not required but we strongly suggest against not using one.

It can be a very simple description of what your Step does, in just a couple of sentences.

Best practice is to include information about how someone else can contribute to the development of the Step.

You can also include a link to the StepLib website, including your own Step's page on StepLib (once it's submitted into the Open StepLib collection), something like this:

This Step is part of the Open StepLib, you can find its page on StepLib here.

How to submit your Step into the Open Step Library

To submit a Step to the Open Step Library you have to create a Pull Request in the StepLib's spec repository and include your step's step.yml description file in the steps/ folder.

  1. Create your Step repository as described above.
  2. Fork the StepLib spec repository: https://github.com/steplib/steplib
  3. Create a new folder inside the steps/ folder (in your forked StepLib spec repository) if it's the first version of your Step. (Example path: steps/my-step). Note: The name of the folder will be the ID of your Step.
  4. Create a folder inside your step's folder with the name of a version tag you added to your Step repository. (Example path: steps/my-step/1.0.0). You have to actually use this tag in your repository. When a user wants to use this version of your Step the StepLib system will try to clone your Step repository with the specified version tag!
  5. Copy your step.yml into this version folder (Example path: steps/my-step/1.0.0/step.yml)
  6. Create and send a Pull Request

Before you submit your Step into a Step Library you should test it in a StepLib compatible system. You can use a free Bitrise account to test your Step.

Trigger a new release

  • merge every code changes to the master branch
  • push the new version tag to the master branch