Release after every tag push

Buddy lets you automatically build, test and release your application whenever a tag is pushed to the repository. This article will tell you how to configure a delivery pipeline triggered on this condition in Buddy.

Release on tag push

The first step towards deployment automation is adding a new project and selecting the repository from which you want to upload. You can choose GitHub, Bitbucket or GitLab repository, as well as any other custom Git repo: Creating a new projectCreating a new project

Once the project is synchronized, you can add a new pipeline. The most important thing is to set it up to run only when a new tag is pushed to the repository. To do that, set the trigger mode to On events, click + to add Git push event, then select Wildcard, and customize the refs/tags pattern that will trigger the pipeline.

For example, setting the pattern to refs/tags/v* will only deploy the tags starting with v, such as v1, v1.1, v2, and so on.

Adding a new pipelineAdding a new pipeline

Build Docker image on tag push

After specifying when and for which tags the pipeline will be triggered, we are ready to define what exactly should be executed.

The pipeline below will:

  1. Run unit tests on repository code
  2. Build a Docker image from the tested code
  3. Run the image to check if everything works properly
  4. Push the image to a Docker registry if all steps above have succeeded Pipeline examplePipeline example

Run unit tests

The core principle of Continuous Integration is testing every change pushed to the repository, tags included. Buddy lets you automatically test your application before the release with build actions which are basically isolated testing environments. For example, if your application is based on Node, you just need to select Node from the action roster and configure its details: Environment customizationEnvironment customization

Build Docker image

The next step is dockerizing the application. To do that, select the Build Image action from the Docker section. There you need to indicate the Dockerfile in your repository and the build context path (optional): Build Docker image action configurationBuild Docker image action configuration

Run Docker image

Now we need to make sure the Docker image that we built is working okay. For that, we shall use the Run Docker Image action. The action lets you run commands in the selected Docker container. Make sure to select the image built in the previous build action, just as it's shown below: Run Docker image environment settingsRun Docker image environment settings

Push Docker image

The last step is pushing the image to the registry. Select Push image and configure the action details. Buddy has native integrations with Docker Hub, Amazon ECR, and Google GCR. You can also select your own private registry.

Since we only release tags in this pipeline, make sure to use the $BUDDY_EXECUTION_TAG variable in the Tags to apply field.

Push Docker Image action configurationPush Docker Image action configuration

See also

Last modified on June 1, 2023


Not sure how to configure a pipeline for your process? Reach out on the live-chat or contact support

Get Started

Sign up for free and deploy your project in less than 10 minutes.