What Are GitHub Actions

What Are GitHub Actions

ยท

2 min read

Hello Everyone I am Goutham here in this blog I want to explain what are github actions.

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. Which means it automates the workflow .

There are some of the most frequently used terms, I would like to explain them. Workflow files must be in the YAML language.

EVENTS

Events are some activities that happen to the repository like creating issue ,making a PR ,pushing Code ....

JOBS

Jobs are specific tasks that can be automated like building and pushing a docker image to the docker hub, like this we can define many jobs in a workflow file. If any event occurs on the repository then jobs are triggered. Jobs contain a set of steps and each step is executed sequentially. Here in this example building, and pushing to the docker hub are different steps. Jobs have no dependencies and run in parallel with each other.

Runners

Runners are the Virtual machine on which a specific job is run.

Workflow

A workflow is a configurable automated process that will run one or more jobs.

All workflow files must be in YAML and in the .github/workflows folder.

Let us now see a simple workflow file.

name: My Simple Workflow
on: 
 push:
  branches: main

Jobs:
 Job1:
 name: My first automated Job
   runs-on: ubuntu-latest
   steps:
      - name: Used to run this jon on the ubuntu runner.
      - uses: actions/checkout@v3
      - run: echo I automated it. 

 Job2:
 name: My second automated Job   
  runs-on:  windows-latest
  steps:
    - uses: actions/checkout@v3
    - name: Installing node 14 
    - uses: actions/setup-node@v3
        with:
          node-version: '14'
      - run: npm install -g bats
      - run: bats -v

This simple workflow file runs 2 jobs.

Jobs are automatically triggered when code is pushed to the main branch, name of the 1st job is My First automated job and runs on ubuntu VM and prints the message and name of the 2nd job is My second automated job and this job runs on a windows VM installs node 14 version ,bats and prints bats version.

Difference between uses and run is uses keyword , allows you to run scripts of others against your code and run tells the job to execute your command on the runner.

So when ever you want to install anything check actions/ path and use accordingly.

That's it about Github actions beginners level. I have explained every thing I know about Gihub actions . If you find any thing wrong please let me know.

Thanks for reading my article.Have a nice day ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

ย