Ultimate CI/CD pipelines using UiPath GitHub Actions and PowerShell

Satish Prasad
14 Min Read
Ultimate CICD pipelines using UiPath GitHub Actions and PowerShell

In this article, weโ€™ll explore the continuous integration and continuous delivery or deployment of UiPath based projects.

Well, CI/CD is not a new term now and it’s being adopted widely across all the organizations with a certain level of automation.

The goal here today is to see how we should be able to automate the delivery of our automation projects to deliver faster and with high quality.

There are several tools available to perform/set up CI/CD pipelines such as Jenkins, Azure pipelines etc. which provides similar functionality.

We have already covered: (See links)

  1. CI-CD Using Jenkins โ€“Implementing CI CD UiPath Using Jenkins Plugin – RPABOTS.WORLD (rpabotsworld.com)
  2. CI-CD Using Azure Pipelines โ€“Implementing CI CD Pipeline for UiPath – RPABOTS.WORLD (rpabotsworld.com)

ย In this tutorial, we will use the following tools: Git, GitHub, GitHub Actions, UiPath Orchestrator to set up complete using

  • First, we’ll cover some important terminology of GitHub Action and define our branching & CI-CD strategy
  • Second, we’ll set up continuous integration automatically run builds and tests using development workflow.
  • And finally, we’ll set up continuous delivery so we can automatically publish to the Production orchestrator using production workflow.
  • Some additional steps like slack notification

Alright, that was a lot.

Letโ€™s get started!

Understanding GitHub Actions

GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository or deploy merged pull requests to production.

Let’s look at various terminology used in GitHub action for automating your pipelines.

Core concepts Used in GitHub Action

  • GitHub provides Linux, Windows, and macOS virtual machines to run your workflows, or you can host your self-hosted runners in your data centre or cloud infrastructure.
  • To automate a set of tasks, you need to create workflows in your GitHub repository. GitHub looks for YAML files inside of the. github/workflows directory.
  • Events like commits, the opening or closing of pull requests, or updates to the projectโ€™s wiki, trigger the start of a workflow. For example, a workflow is triggered when somebody pushes to the repository or when a pull request is created. Events can also be configured to listen to external events using Webhooks.
  • Workflows are composed of jobs.
  • Jobs are made up of multiple steps and run in an instance of the virtual environment. Jobs can run independently of each other or sequential if the current job depends on the previous job to be successful.
  • A step can be a set of shell commands or an action, which is a pre-built, reusable step implemented
  • Actions are the smallest portable building block of a workflow and can be combined as steps to create a job. You can create your Actions or use publicly shared Actions from the Marketplace.

If you have noticed the above description, you will see that it flows the YAML Markup language which is widely used in other CI/CD tools (Such as Azure) โ€ฆ

How to Set up GitHub Actions

GitHub Actions uses YAML syntax to define the workflow.

  1. Each workflow is stored as a separate YAML file in your code repository, in a directory called. github/workflows.
  2. You should be able to select a workflow from the ones available or create a new one. For this tutorial, we will create new.
  3. To create your workflow, create a .yml file in the path .github/workflows/action1.yml. Commit the file, GitHub will automatically understand that it is a workflow.
  4. For securityโ€™s sake, itโ€™s important not to hard code secrets inside the codebase. A good way to avoid this is by using environment variables to refer to the secrets.
  • Open your repository on GitHub and go to the Settings tab. On the left navigation bar, click Secrets.
  • Here we can define any ORCH_URL, ORCH_TENANT, ORCH_CLIENT_ID, ORCH_USER_KEY, ORCH_ACC_NAME or ENV Specific Values.

Pretty easy right!

Letโ€™s first understand the branching strategy and then we will create our workflow step by step.

GitHub Password management

GitHub Branching and CI/CD strategy [You can define as per need]

  1. GitHub repository with two branches โ€˜masterโ€™ and โ€˜developโ€™ to track the UiPath project.
  2. New โ€˜featureโ€™ branch from develop branch (to perform changes)
  3. pull request against the develop branch on GitHub
  4. Two CI/CD pipelines (Separately for development and production using yml file configuration) to publish changes in the UiPath Orchestrator environment.
  5. Development pipeline will run when pull request successfully merged with develop branch.
  6. The production pipeline will run when the developed branch will be merged with the master branch.

The diagram below fully details this strategy:

GitHub Branching and CI/CD strategy

Set up the GitHub repository for UiPath Project

  1. Go ahead and log into your GitHub account. Click on the + sign in the top right corner, then click on new repository:
  2. Let’s say – uipath-with-github-action (Name of Repository)
  3. At this point in the article, we assume that you understand how to manage different branches using git client or UiPath Studio.
  4. Next; Create a new project/or use the existing UiPath project and perform git init to initialize it locally
  5. Now we need to set up a remote repository so that it can be tracked remotely. This can be done using UiPath Studio using manage Remotes
    1. Give a Name โ€“ Say, Master
    2. URL – https://github.com/rpabotsworld/uipath-with-github-action.git
  6. The above will automatically create a master branch for you. Simply create a new branch called to develop with the following command using git client or UiPath Studio or “git checkout -b develop”
  7. Now, letโ€™s go back to our project on GitHub-actions- UiPath and click on Settings > Secrets > New repository secret, as shown in the screenshot below:
  8. Now weโ€™re done with our GitHub and local repo setup.
GitHub Password management Records

Set up GitHub Actions

  1. Create a folder at the root of the project named (.github). Inside (. github) , create a new folder called workflows. Inside the workflows folder, create a file named development.yml
  2. Similarly, create another workflow with name production.yml
  3. UiPath Donโ€™t provide any native plugin for GitHub Action so we have used the unofficial library of DevOps PowerShell scripts. which allow us to package, deploy and run automation and tests. (See Link here – UiPath-DevOps-Scripts )
  4. The PowerShell scripts have a dependency on UiPath-dev – UiPath.CLI (Can be downloaded & set up via nuget/UiPath.CLI )

The overall structure of developement workflow

Understanding the development workflow file

  • uses: actions/checkout@v2: For us to run our PowerShell, we need to have it available. This checks out our code on our job environment so we can use it to build, publish &test.
Ultimate CI/CD pipelines using UiPath GitHub Actions and PowerShell 3
github Pull Request

Production Workflow File

Understanding the production workflow file

  • uses: actions/checkout@v2: For us to run our PowerShell, we need to have it available. This checks out our code on our job environment so we can use it to build, publish &test.
Ultimate CI/CD pipelines using UiPath GitHub Actions and PowerShell 4

Summary

In this article, we’ve built a CI/CD process using Github actions.

We started by adding the CI process which runs theย  tests and tells our code reviewers that the Pull Request is ready for review.

There is so much more that can be done with GitHub actions. We hope this tutorial got you started with building a CI/CD process that is helpful and meaningful for your team.

References –

Share This Article
Follow:
Hey there, I'm Satish Prasad, and I've got a Master's Degree (MCA) from NIT Kurukshetra. With over 12 years in the game, I've been diving deep into Data Analytics, Delaware House, ETL, Production Support, Robotic Process Automation (RPA), and Intelligent Automation. I've hopped around various IT firms, hustling in functions like Investment Banking, Mutual Funds, Logistics, Travel, and Tourism. My jam? Building over 100 Production Bots to amp up efficiency. Let's connect! Join me in exploring the exciting realms of Data Analytics, RPA, and Intelligent Automation. It's been a wild ride, and I'm here to share insights, stories, and tech vibes that'll keep you in the loop. Catch you on the flip side
1 Comment