<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: asanka rajanayaka</title>
    <description>The latest articles on DEV Community by asanka rajanayaka (@asanka_rajanayaka_f39c8df).</description>
    <link>https://dev.to/asanka_rajanayaka_f39c8df</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3721008%2F16e45644-096f-4fe7-8e55-2381f9ac3edb.jpg</url>
      <title>DEV Community: asanka rajanayaka</title>
      <link>https://dev.to/asanka_rajanayaka_f39c8df</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/asanka_rajanayaka_f39c8df"/>
    <language>en</language>
    <item>
      <title>Git Hub Workflow - part 1</title>
      <dc:creator>asanka rajanayaka</dc:creator>
      <pubDate>Wed, 21 Jan 2026 16:07:16 +0000</pubDate>
      <link>https://dev.to/asanka_rajanayaka_f39c8df/git-hub-workflow-part-1-206o</link>
      <guid>https://dev.to/asanka_rajanayaka_f39c8df/git-hub-workflow-part-1-206o</guid>
      <description>&lt;p&gt;In the world of modern software engineering, manual deployments and local testing are relics of the past. If you want to build robust, scalable applications, you need to master GitHub Workflows.&lt;/p&gt;

&lt;p&gt;Today, we’re breaking down everything you need to know to transform your repository into an automated powerhouse.&lt;/p&gt;

&lt;h2&gt;
  
  
  what is a github Workflow?
&lt;/h2&gt;

&lt;p&gt;A GitHub Workflow is an automated pipeline defined in a YAML file. It lives right inside your repository and handles the heavy lifting of building, testing, and deploying your code.&lt;/p&gt;

&lt;p&gt;The Essentials:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Location&lt;/strong&gt;: Stored in the &lt;code&gt;.github/workflows/&lt;/code&gt; directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Triggers&lt;/strong&gt;: Activated by events like a &lt;strong&gt;push&lt;/strong&gt;, &lt;strong&gt;pull_request&lt;/strong&gt;, or even a &lt;strong&gt;schedule&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Environment&lt;/strong&gt;: Runs on GitHub-hosted virtual machines (Ubuntu, Windows, macOS) or your own self-hosted runners.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How It Makes CI/CD Easy
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Continuous Integration (CI)&lt;/strong&gt; is simplified because there are no servers to manage. Everything is defined in a simple, human-readable YAML file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Deployment (CD)&lt;/strong&gt; becomes seamless because your code and your deployment logic live in the same place. With built-in Secret Management, you can deploy to production securely without ever hard-coding a password.&lt;/p&gt;

&lt;h2&gt;
  
  
  Main Part Of Workflow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Trigger (when to run)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Jobs (what machines to use)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Steps (what to execute)&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is a minimum GitHub workflow example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: CI Pipeline
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  what is GitHub action?
&lt;/h2&gt;

&lt;p&gt;A GitHub Action is a reusable piece of automation logic designed to perform a specific, isolated task within a GitHub workflow. Think of it as a modular "building block" for your automation pipeline&lt;/p&gt;

&lt;p&gt;Key Points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reusable Unit of Work&lt;/strong&gt;: Once an action is created, it can be used across multiple different workflows and projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Used Inside Workflow Steps&lt;/strong&gt;: Actions are called within the &lt;code&gt;steps&lt;/code&gt;section of a job.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Created by GitHub or the Community&lt;/strong&gt;: You can use official actions from GitHub or leverage thousands of actions shared by the developer community.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stored in a Repo&lt;/strong&gt;: Every action lives in a repository, which allows for version control (&lt;code&gt;eg @v4&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Do Actions Exist?&lt;/strong&gt;&lt;br&gt;
The primary purpose of Actions is to eliminate redundancy. Instead of writing long, complex shell scripts repeatedly across different projects to handle common tasks, you use an Action.&lt;/p&gt;

&lt;p&gt;Eg: Checking out Code Instead of manually writing a script to perform a &lt;code&gt;git clone&lt;/code&gt;, you use the official checkout action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- uses: actions/checkout@v4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lets deep dive into few main key aspect we commonly used with github workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;name&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This provides a human-readable name for your workflow. It is what you will see in the "Actions" tab of your GitHub repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: CI Pipeline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. &lt;code&gt;on&lt;/code&gt;(Trigger)
&lt;/h2&gt;

&lt;p&gt;Defines when the workflow should run. You can use single triggers or combine multiple triggers together.&lt;/p&gt;

&lt;p&gt;Most common triggers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;push&lt;/code&gt;&lt;/strong&gt;: Runs when code is pushed to a specific branch.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;on:
  push:
    branches: [ main ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;pull_request&lt;/code&gt;&lt;/strong&gt;: Used to validate code before it is merged into the main branch
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;on:
  pull_request:
    branches: [ main ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;workflow_dispatch&lt;/code&gt;(manual)&lt;/strong&gt; : Adds a button in the GitHub UI to allow manual runs
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;on:
  workflow_dispatch:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;schedule&lt;/code&gt;(cron)&lt;/strong&gt; : Runs at specific times (e.g., nightly reports).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;on:
  schedule:
    - cron: "0 2 * * *"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also there is option if we need to filter specific files change to Triggers the workflow, leading to faster pipelines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;on:
  push:
    paths:
      - "src/**"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Multiple triggers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we need to run a workflow by combining more than one trigger, we can use multiple triggers&lt;/p&gt;

&lt;p&gt;This workflow will run for Push, PR and Manual run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;on:
  push:
    branches: [ main ]
  pull_request:
  workflow_dispatch:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3.&lt;code&gt;jobs&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A job is a set of steps that execute on the same runner (virtual machine). A workflow can contain one or many jobs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic structure&lt;/strong&gt;&lt;br&gt;
You define a job ID (like &lt;code&gt;build&lt;/code&gt;) and the machine type (&lt;code&gt;runs-on&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;build → job name (ID)&lt;br&gt;
runs-on → runner (machine)&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jobs:
  build:
    runs-on: ubuntu-latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What Contain in a job&lt;/strong&gt;?&lt;br&gt;
It contains a set of steps. (In the next topic, we will discuss the steps.)&lt;br&gt;
All steps inside a single job run one after another and share the same filesystem. If one step fails, the whole job fails.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Hello CI"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The run behavior of jobs can be divided into two parts for comparison.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.Multiple jobs&lt;/strong&gt;&lt;br&gt;
This is a Parallel Executio. By default, multiple jobs run at the same time to speed up CI.&lt;/p&gt;

&lt;p&gt;Eg: lint and test ran in parallel&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jobs:
  lint:
    runs-on: ubuntu-latest
  test:
    runs-on: ubuntu-latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2.Job dependencies&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;needs&lt;/code&gt; is used to define job dependencies. It ensures that one job waits for another to complete before running.&lt;/p&gt;

&lt;p&gt;Eg: deploy ran only if build succeeded&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jobs:
  build:
    runs-on: ubuntu-latest

  deploy:
    runs-on: ubuntu-latest
    needs: build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4.&lt;code&gt;steps&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A step is a single action or command execute inside a job.&lt;br&gt;
Steps run one by one, in order.&lt;/p&gt;

&lt;p&gt;There are 2 type of steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;run&lt;/code&gt;(Shell Commands)&lt;/strong&gt;
Used for CLI commands, scripts, or running tests
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- run: npm install
- run: npm test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can also use multi-line:&lt;/p&gt;

&lt;p&gt;Lets if need to performs two distinct actions of &lt;code&gt;npm install &amp;amp;&amp;amp; npm run build&lt;/code&gt;. Installing dependencies and then executing the project's build script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- run: |
    npm install
    npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;uses&lt;/code&gt;(GitHub Action)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Used for reusable logic, setting up tools and Third-party integrations. This avoids manual scripting for common tasks like checking out code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- uses: actions/checkout@v4
- uses: actions/setup-node@v4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look this Basic Full Example of Steps&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-node@v4
    with:
      node-version: 20
  - run: npm ci
  - run: npm test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my upcoming blog, We’ll dive deeper into some of the most powerful workflow concepts. We’ll explore Runners, environment variables, secrets management, strategies, and conditional execution.&lt;/p&gt;

</description>
      <category>github</category>
      <category>cicd</category>
    </item>
  </channel>
</rss>
