Tutorial: Continuous integration - The basics
Adding a hook for CI
The next step is to add a webhook that will trigger our test and deploy phases when a push is taking place.

To add this hook, you have to login and go to Settings / Webhooks / Add menu.

Scroll to build type and click Generic link.
Now, you can choose what repository and branch we want to add this hook to. Please note that both fields are regular expressions. So, with a single hook you can cover more/all repositories and branches.
Just type your repository name. For branch, leave it empty, meaning that any branch will trigger the hook.

Then, type a description to easy remember what the hook is for, for example: "This will deploy main.sh to the servers".

If you need to pass some secrets to the build environment, fill them in the Secrets area. Please note that after you save your changes, you will not be able to see the secrets anymore, only to change them.
To use them, just use them as environment variables.

You have to choose what events will trigger the hook: we will use Push event.

Next, you will have to choose a build environments. For our example, we will use only one environment, 'debian-10-amd64'. You will use multiple build environments when you want to be sure your application will work across a full range of distributions and architectures combinations.

Next, you will be able to specify what packages are needed to build and test your software. You can type 'bash' there, because we have a set of bash scripts.

What is left is to specify is which commands we want to execute. First command will be './test.sh' and we will check the checkbox "Abort on fail?". Why? Because if the test does not pass, we will not want to execute the deploy step.
Optionally, you can add some labels which will be added to your last commit in that branch.
For the second command you will type './deploy.sh'.
Then, press 'Add'. We are ready to use the hook.