Master GitHub Actions with This Easy Tutorial

Logan Jul 13, 2026

Harnessing the power of GitHub Actions can automate your software development lifecycle, from code testing to deployment. Let's delve into a step-by-step tutorial on creating and managing GitHub Actions, ensuring your CI/CD pipeline runs smoothly.

GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker

Before we dive in, make sure you have a GitHub account and a local repository cloned on your machine.

Nikki Siapno on LinkedIn: GitHub Actions — How do you optimize their performance? GitHub Actions is…
Nikki Siapno on LinkedIn: GitHub Actions — How do you optimize their performance? GitHub Actions is…

Creating Your First GitHub Action

Our journey begins by creating a simple GitHub Action workflow. This workflow will run every time you push changes to your repository's main branch.

LetsDevOps: GitHub Actions Tutorial for Beginner's
LetsDevOps: GitHub Actions Tutorial for Beginner's

First, navigate to the '.github' folder in your repository. If it doesn't exist, create it. Then, create a new folder named 'workflows'. Inside this folder, create a new file named 'ci.yml'.

Understanding the Action Workflow

Get Started with GitHub Easily — A Complete Beginner’s Guide to GitHub
Get Started with GitHub Easily — A Complete Beginner’s Guide to GitHub

GitHub Actions use YAML files to describe jobs and steps. Let's create a basic workflow that says "Hello, World!" and lists all the files in your repository.

< PRE> ```yaml name: CI on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: echo "Hello, World!" - run: ls -la ```

The 'name' and 'on' keys define the workflow's name and trigger, respectively. The 'jobs' keyanutates the job to run, specifying the operating system where the job will run and the steps to execute.

The steps are simple Bash commands ran sequentially. 'actions/checkout@v2' is a GitHub Action that checks out a copy of your code to the runner.

A Beginners Guide to CI/CD with GitHub Actions
A Beginners Guide to CI/CD with GitHub Actions

Let's Add Testing to Our Workflow

To further illustrate GitHub Actions' power, let's add a step to run unit tests. We'll assume you're using JavaScript and the 'jest' testing framework.

< PRE> ```yaml # ... (previous code) - name: Run Tests run: npm test ```

This adds a step that runs the command 'npm test', which typically triggers your tests if you've set up 'jest' in your project.

How GitHub Actions 10x my productivity
How GitHub Actions 10x my productivity

Building and Deploying with GitHub Actions

Now that we have a basic workflow, let's expand it to include building and deploying our application.

Git Workflow
Git Workflow
Git & GitHub Roadmap for Beginners
Git & GitHub Roadmap for Beginners
How to Clone a Repository Using GitHub Desktop
How to Clone a Repository Using GitHub Desktop
Switch Between Git Branches (Day 18 Git Guide)
Switch Between Git Branches (Day 18 Git Guide)
Your First Open Source Contribution: A Beginner's GitHub Guide 🌱💻
Your First Open Source Contribution: A Beginner's GitHub Guide 🌱💻
Git & GitHub Commands Cheat Sheet 💻 | Essential Developer Guide
Git & GitHub Commands Cheat Sheet 💻 | Essential Developer Guide
the git chatsheet screen is lit up with orange and green text on it
the git chatsheet screen is lit up with orange and green text on it
Git Vs Github
Git Vs Github
An Intro to Git and GitHub for Beginners (Tutorial)
An Intro to Git and GitHub for Beginners (Tutorial)
the instructions for how to use git property in an interactive video game, with text below
the instructions for how to use git property in an interactive video game, with text below
Top 5 Courses to Learn #GitHub Actions in 2025
Top 5 Courses to Learn #GitHub Actions in 2025
Git commands Cheat Sheet
Git commands Cheat Sheet
Beginner's Guide to GIT | GitHub
Beginner's Guide to GIT | GitHub
Git Workflow Roadmap
Git Workflow Roadmap
the ultimate guide to creating an awesome cst chart
the ultimate guide to creating an awesome cst chart
Git
Git
a laptop computer sitting on top of a desk next to a cup of coffee and pen
a laptop computer sitting on top of a desk next to a cup of coffee and pen
Introduction to Git & Version Control | Beginner's Guide
Introduction to Git & Version Control | Beginner's Guide
How GitHub Actions can improve CI/CD and compares with Azure Pipelines
How GitHub Actions can improve CI/CD and compares with Azure Pipelines
#git #github #versioncontrol #interviewpreparation #softwaredevelopment #devops #learningjourney #sdet #qatesting | Satya Tharun Manikanta Nalle
#git #github #versioncontrol #interviewpreparation #softwaredevelopment #devops #learningjourney #sdet #qatesting | Satya Tharun Manikanta Nalle

For this example, let's deploy a static site to GitHub Pages.

Building the Site

First, let's add a step to build our site. We'll assume you're using 'gh-pages' to build and deploy a static site.

< PRE> ```yaml # ... (previous code) - name: Build Site run: npm run build ```

Deploying to GitHub Pages

Finally, let's deploy our site to GitHub Pages. We'll use the 'peaceiris/actions-gh-pages@v3' Action for this. Remember to replace '/your-site-name' with the name of your repository.

< PRE> ```yaml # ... (previous code) - name: Deploy to Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./build publish_branch: gh-pages ```

Now, whenever you push changes to the 'main' branch, GitHub Actions will check out your code, run tests, build your site, and deploy it to GitHub Pages.

Embracing GitHub Actions can significantly streamline your development process. Start small, build upon your initial workflow, and soon you'll be automating complex tasks. Happy coding!