Introduction
Embarking on the journey of continuous integration and continuous deployment (CI/CD) is crucial for modern software development. It streamlines the process of building, testing, and deploying code changes, ensuring a faster and more reliable development lifecycle. CircleCI is a robust CI/CD platform that seamlessly integrates with your GitHub repositories, providing automation and efficiency.
This blog post is your guide to kickstarting your CI/CD journey with CircleCI. We’ll walk through the steps to connect your GitHub repository with CircleCI, enabling automated workflows and streamlined development practices.
Prerequisites
Before diving into the integration process, ensure you have the following:
- GitHub Account: Make sure you have an active GitHub account. If not, you can sign up here.
- CircleCI Account: Sign up for a CircleCI account if you haven’t already. You can do this by visiting the official website: CircleCI Signup.
- SSH Key Pair: We’ll be using SSH keys to establish a secure connection between CircleCI and your GitHub repository.
Step-by-Step Guide
Go to the CircleCI official website and if you don’t have your account on it then do signup.
https://circleci.com/vcs-authorize/
Once you complete the signup process by providing the email address and password, you will get an email that you provided on the CircleCI SignUp process.
Kindly verify your email address and go to the CircleCI official website again https://circleci.com/vcs-authorize/.
Click on the login
Click on the New Project.
You will be landed on the below page
As you observe, in the previous screenshot we got some instructions to connect our Repository of GitHub with CircleCI.
Let’s follow this.
Copy the first step command and paste it into your terminal to generate a new ssh key
ssh-keygen -t ed25519 -f ~/.ssh/project_key -C email@example.com
You will see two files that are generated after running the above command.
Copy the content of the public key
cat project_key.pub
Now, we have to paste the public key to the repository that we want to integrate with CircleCI.
Let’s take a demo repository and click on Settings.
Click on Deploy keys
Click the Add deploy key
Paste the public key that you have copied in the earlier steps and check the Allow write access because CircleCI will create some config files like .circleci and config.yml.
Click on the Add key.
Copy the content of the private key.
cat project_key
Go back to the CircleCI page and paste the private key in the dialog box.
Also, I have selected the same repository in which I created the deploy key.
Click on Create Project.
After clicking on Create Project, CircleCI will start to write the configurations and deploy a hello workflow message to show you that your CircleCI integration is successful with GitHub.
Your integration is successful. Now you can modify the config.yml file according to your requirements.
If you observe, CirceCI pushed some changes on circleci-project-setup.
Click on Compare & pull request and click Pull Request.
Once you create the Pull Request and click on Merge pull request.
Once you merge the changes, your repository will have one more folder named .circleci.
Inside the .circleci folder, you will see the config.yml file which is used to create your customized pipeline like you do for other CI/CD tools.
Conclusion
Congratulations! You’ve successfully connected your GitHub repository with CircleCI, laying the foundation for automated CI/CD workflows. With CircleCI, you can now effortlessly manage your development pipeline, ensuring faster and more reliable software delivery. Explore the .circleci/config.yml
file to tailor your workflows and adapt them to your specific project requirements. Happy coding!