DEV Community

Cover image for Hello World in GitHub Actions: A Beginner's Guide to Your First Workflow
Panchanan Panigrahi
Panchanan Panigrahi

Posted on

Hello World in GitHub Actions: A Beginner's Guide to Your First Workflow

What Is a CI/CD Pipeline?

A CI/CD (Continuous Integration/Continuous Deployment) pipeline is a robust automated process that orchestrates code changes from development to production. It streamlines software delivery, ensuring code integration, testing, and deployment in a seamless, efficient manner. These pipelines automate workflows, enhancing collaboration, and enabling rapid, reliable software releases.

We will use github action for CI and argocd for CD pipeline.

Lets understand github action workflow first.

How to Set Up A Github Action CI Workflow

  1. Create a .github/workflows directory:

    • In your GitHub repository, create a new directory named .github/workflows.
  2. Add a YAML file for your workflow:

    • Inside the workflows directory, create a YAML file (e.g., main.yml) to define your CI workflow to trigger events.

GitHub Actions Workflow Lifecycle

  1. Triggering Event:

    • The workflow kicks off in response to predefined trigger events, such as pushes, pull requests, or scheduled intervals.
  2. Workflow File Interpretation:

    • GitHub Actions locates and interprets the workflow file (typically named .github/workflows/main.yml) in the repository, extracting instructions for the CI/CD process.
  3. Job Execution:

    • The workflow file defines one or more jobs, each representing a set of tasks. These jobs can run concurrently or sequentially on the designated runner environment.
  4. Step-by-Step Execution:

    • Within each job, individual steps are executed sequentially. These steps encompass various actions, commands, or scripts, performing tasks like code checkout, dependency installation, testing, and deployment.
  5. Status Monitoring and Notifications:

    • GitHub Actions updates the workflow status based on the success or failure of each step. Users can track the workflow's progress in the GitHub Actions dashboard and configure notifications to stay informed about status changes. This lifecycle ensures a streamlined and automated CI/CD pipeline.

I think the best way to learn github action through a project.

Certainly! Let's set up a basic GitHub Actions workflow for a simple project. Follow these steps:

  1. Create Repository:

    • Go to GitHub and create a new repository named github-action-demo.
  2. Local Setup:

    • Clone the repository to your local machine:
     git clone
  • Navigate to the project directory:

     cd github-action-demo
  1. Create .github/workflows Directory:

    • In your project's root directory, create a new directory named .github/workflows:
     mkdir -p .github/workflows
  2. Add main.yaml Workflow File:

    • Now, let's set up a file named main.yaml inside the new .github/workflows folder. Copy and paste the following code:
     name: CI
           - main
         runs-on: ubuntu-latest
           - name: Get Your Code
             uses: actions/checkout@v2
           - name: Say Hello to the World
             run: echo "Hello, World!"

This simple setup is like giving your project a set of instructions. Whenever you make changes and push them to the main branch, GitHub will follow these instructions. It will fetch your code, and just to prove it's working, it will print "Hello, World!" Think of it like your project saying hi to the world when changes happen! 🌍✨

  1. Commit and Push Changes:

    • Commit the changes and push them to GitHub:
     git add .
     git commit -m "Add GitHub Actions workflow"
     git push origin main
  2. Check GitHub Actions Tab:

    • Visit your GitHub repository, go to the "Actions" tab, and you should see the CI workflow being triggered.


GitHub Actions simplifies the process of automating CI/CD pipelines for software development. With easy-to-follow steps, you can set up workflows to handle tasks like code integration, testing, and deployment seamlessly. By embracing GitHub Actions, developers can streamline their workflow and accelerate software delivery with minimal effort. Start leveraging GitHub Actions today to enhance your development process and deliver high-quality software efficiently.🚀🛠️

Top comments (0)