-->

  • Github Actions CI CD Pipelines WorkFlows

     

    Github Actions CI CD Pipelines WorkFlows

     

     Hello Viwers, I am back again with another blog and the topic name is Github Actions CI CD Pipelines WorkFlows. So in this blog we will consider so many thing about CI/CD pipelines workflows like what is Github Actions, how to use - step by step, can i used github actions for CI/CD, A demo workflows file - How to create, run and check results, Terms: Workflows, Events, Jobs, Steps.


    Can i used github actions for CI/CD?



    Yes, GitHub Actions is commonly used for Continuous Integration (CI) and Continuous Deployment (CD) workflows.


    What is Github Actions?



    GitHub Actions is an automation platform provided by GitHub that allows you to set up workflows for your software development projects. It enables you to automate various tasks, such as building, testing, and deploying your code directly from your GitHub repository.

    Key features of GitHub Actions include:


    - Automate SDLC workflows

    - Implement CI CD DevOps

     

     


     

     

    Demo

     

    Let's start with the demo how to use github action. Actually you don't got anywhere for using CI/CD, you can use all features in GitHub Action.

    Step 1 - Signup and Login to GitHub.com 

    Step 2 - Create a new Repository

     Go to this  + Plus button dropdown. Click on new repository.

     

    Github Actions CI CD Pipelines WorkFlows

     

     Now i will called as github-actions and set as public and click on create repository button (when go to scroll down on same page).


    Github Actions CI CD Pipelines WorkFlows


     Step 3 - In the repo create a folder .github/workflows

     here you can either create manually and then commited push to the repository. or you can go to this action tab.

     

     

    Github Actions CI CD Pipelines WorkFlows

     

     here you can see the github actions and you can also use templates or use workflows yourself but we will go to setup workflows as yourself.


    Github Actions CI CD Pipelines WorkFlows



    Step 4 - In the folder create a YAML file with .yml extension


    Here this will automatically create .github/workflows folder  and the name of main.yml file but this is empty code. yaml is programming language and .yml this is a file format but particular syntax.

     

     

    Github Actions CI CD Pipelines WorkFlows

     

      

    Step 5 - Add the content of the workflow in the file


    Now content adding time..

    Go to this link and copy the syntax of printing of hello world and you can also use online yaml formater online as a precautions of indentation error.

    Hello World - CLICK HERE

    YAML Formatter - CLICK HERE

     

     

    name: hello-world
    'on': push
    jobs:
      my-job:
        runs-on: ubuntu-latest
        steps:
          - name: my-step
            run: echo "Hello World!"
    
    

     

     

     

    Certainly! The YAML code you've provided is a simple GitHub Actions workflow. Let's break down each part:

    ```yaml
    name: hello-world
    ```


    This sets the name of your workflow. In this case, it's named "hello-world." This name is just for your reference and doesn't affect the functionality of the workflow.

    ```yaml
    on: push
    ```


    This specifies the event that triggers the workflow. In this case, the workflow will be triggered whenever there is a `push` event to the repository.

    ```yaml
    jobs:
      my-job:
        runs-on: ubuntu-latest
        steps:
    ```


    Here, you define a job named "my-job" that runs on an `ubuntu-latest` virtual machine. This means the steps within this job will be executed on a machine with the latest version of Ubuntu.

    ```yaml
      - name: my-step
        run: echo "Hello World!"
    ```


    Within the job, you define a step named "my-step." This step uses the `run` key to specify the command that should be executed. In this case, it's a simple command to echo "Hello World!" to the console.

    So, when a `push` event occurs in your repository, GitHub Actions will execute this workflow. The workflow consists of one job named "my-job," which runs on an Ubuntu machine. In that job, there's a single step named "my-step" that echoes "Hello World!" to the console.

    This is a basic example, and GitHub Actions can be extended to perform more complex workflows, such as running tests, building and deploying applications, and more, depending on the needs of your project.

     

     

     

    Github Actions CI CD Pipelines WorkFlows

     

    Step 6 - Commit and push the changes

     

     

    Github Actions CI CD Pipelines WorkFlows

     

     

    This should start with github actions workflows.

     

    Step 7 - Go to Repo main page and click "ACTIONS TAB" 

     

     

    Github Actions CI CD Pipelines WorkFlows

     

     

    So this is our workflow



    Step 8 - Select the workflow from left sidebar and check the logs

     


    Github Actions CI CD Pipelines WorkFlows



    Here is the single job ( i have only one thats why)  When we click on this job, here we can see the logs. Here we have a job. 


    # First it is setup that will the spin up ubuntu system, as you can see, it is running the ubuntu image (operating system).

    # Second this is the actual job. By step here it is running, this comment "echo hello world" which is printing hello world. 

    # Third one is completing the job, doing all the cleanup process.

    So, This is how it is running ...ummm looking good LOL ;-)



    Github Actions CI CD Pipelines WorkFlows


    Also if you want to re-run this job, you can also click on it.



    Github Actions CI CD Pipelines WorkFlows

    Github Actions CI CD Pipelines WorkFlows



    You can also check all types of detals like Usage, Workflow file.

    Don't forget to explore more things and forget to share....




     

    Disclaimer



    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

     

     
  • 0 comments:

    Post a Comment

    For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.