---
# System prepended metadata

title: GitHub Actions Basic Concepts of CI/CD Pipeline
tags: [git, ' workflow']

---

---
tags: git, workflow
title: GitHub Actions Basic Concepts of CI/CD Pipeline
---

 # GitHub Actions Basic Concepts of CI/CD Pipeline

Learn basics of GitHub CI/CD basics.

## name

- The name of your workflow. You can keep any name.
- name is optional property. 
- ![](https://i.imgur.com/AJOzcjG.png)


## Events 

- Every time something get pushed into master or you want to merge in to master you want to trigger your Jobs. 
- **on** is required property

![](https://i.imgur.com/AS3YGKi.png)


## Jobs

- **jobs** is Required filed 
- Job Names could be anything you can give. 
- Job basically groups a setup of actions that will be executed on the events mentioned on attribute. 
- In below example I have a build job. 

![](https://i.imgur.com/W3AfGgx.png)

## Runs on 

The servers that I mention that GitHub makes available where the workflow will run. It has 3 major Operating System.

- Ubuntu
- Windows
- macOS

![](https://i.imgur.com/PKhK7DI.png)

You can run on multiple OS same workflow by  using **matrix**

![](https://i.imgur.com/PJEsjYB.png)


When You push your code notice 3 builds are running in 3 OS.

![](https://i.imgur.com/1RM6Ehe.png)




## Actions

- These are official pre-created repositories in actions list already available and defined with some versions.
- You don't need to install those actions or define.
- You can use actions in your CI/CD with "uses" attribute.


Check out all actions here: https://github.com/actions

In below example "setup-java@v1" Java version 1 will be installed and available in build machine. You can setup any environment like "setup-node@v1" will install node before you build. 

![](https://i.imgur.com/I462shW.png)


### Choosing Actions to your CI/CD pipeline

Suppose I want to use Setup Node.js environment 

Go to github marketplace and search for 'Setup Node.js environment'

https://github.com/marketplace/actions/setup-node-js-environment 

![](https://i.imgur.com/hmlzqEC.png)

```yaml=
- name: Setup Node.js environment
  uses: actions/setup-node@v2.1.4
```

## Run 
When you want to Run a Linux or windows command Line commands Use the "run" attribute. 

![](https://i.imgur.com/UGYtl9d.png)




