Create your First CI/CD Pipeline using GitHub Actions

Getting Started with CI/CD

For a quick demo of how Continuous Integration and Continuous Delivery works, we will use GitHub actions to automate test for our software workflows.

Create a repository called test.

Next, tick the add a .README file and click on Create repository.

Click on the Actions icon at the top to set up your action. We will be using the super-lint pipeline. Click set up a workflow yourself.

https://gist.github.com/Scofield-Idehen/222e4fd258359723c6839db29f3fa437

Create your file with a .YAML extension /.GitHub/workflows/test.YAML.

Populate the editor with these lines.

The above instructions are template-based and a bit sophisticated for beginners. We will see a much more simplified way to write these instructions.

Remember, as we improve, we will want to build our actions faster and more streamlined to our needs.

GitHub actions will test whenever we push new software to our repository.

We will use a CI/CD pipeline called Super-lint to validate our software. Super-lint detects faults and alerts us so we can correct them quickly.

First, give our action a name test.YAML. Next, we say, when our HTML software is triggered, or any changes in the software occur, super-lint should run a test on it.

Ubuntu-latest is our virtual environment deployed on Git to test our software, and we can also deploy on Windows and macOS.

We will create a .HTML file and commit it so our super-lint is triggered and a test starts.

Super-lint will check our software based on the parameters set up.

The test has been completed and showed no error in our software.

Continuous delivery and deployment

After testing our software using super-lint, we will deploy it using GitHub pages.

Create a new repository on GitHub and name it anyname.GitHub.io. Inside the repository, create an index.HTML file and populate it with the following.

Next, create an Actions as before using super-lint, we should have two files in our deployment.github.io repository.

  • index.HTML
  • deployment.YAML

Go to settings and click pages, change the branch from none to main and extension to /root. Click on save.

Click on the link to see your deployed website.

Click on Actions. GitHub actions built and tested our software using the super-lint framework we created.

We added more lines to our index.HTML

GitHub actions built and tested our software again before deploying it to our live host.

Reload the website, and you will see the updated changes.

Conclusion

We just learnt how to create a github Actions and see how it works, to get more ideas on how to build more scalable github actions, check out the following resources.

Resource

Leave a Comment

Your email address will not be published. Required fields are marked *