DEV Community

Cover image for CI/CD Pipeline with GitHub Actions: Deploy Your App in Minutes

CI/CD Pipeline with GitHub Actions: Deploy Your App in Minutes

"Move fast and break nothing. CI/CD is the seatbelt that lets us accelerate safely."— Charity Majors, CTO at Honeycomb.io

Table of Contents

  1. Introduction
  2. What is CI/CD
  3. Getting Started with GitHub Actions
  4. Creating Your First GitHub Actions Workflow
  5. Auto-Deploy to Production (Example: Docker + Nginx)
  6. Key Stats & Interesting Facts
  7. FAQs
  8. Key Takeaways
  9. Conclusion

1. Introduction

Shipping code faster, safer, and more consistently — that’s the DevOps dream. And with GitHub Actions, it’s now easier than ever to build powerful CI/CD pipelines directly within your GitHub repository — no Jenkins, no external CI tools, just YAML and your code.
In this blog, you'll learn how to create a CI/CD pipeline using GitHub Actions to test, build, and deploy your application with minimal configuration — in just minutes, not hours.

2. What is CI/CD (And Why It Matters)

  • CI (Continuous Integration): Automatically tests and merges code changes into the main branch.
  • CD (Continuous Deployment): Automatically pushes those changes to your production or staging environment.

Together, they:

  • Prevent bugs before they go live
  • Speed up release cycles
  • Increase team productivity
  • Reduce human error

Think of CI/CD as your invisible assistant — always building, testing, and shipping code in the background.

3. Getting Started with GitHub Actions

Prerequisites:

  • A GitHub repository
  • A simple app (Node.js, Python, or Dockerized app)
  • SSH/FTP access to your server, or Docker + Nginx environment

4. Creating Your First GitHub Actions Workflow

Let’s create a basic CI/CD workflow to:

  • Install dependencies
  • Run tests
  • Build Docker image
  • Deploy to remote server

GitHub Actions Directory

Create a .github/workflows folder in your repo:

mkdir -p .github/workflows 
Enter fullscreen mode Exit fullscreen mode

.github/workflows/deploy.yml

name: CI/CD Pipeline on: push: branches: - main jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '18' - name: Install dependencies run: npm install - name: Run tests run: npm test - name: Build Docker image run: docker build -t my-app . - name: Deploy to server via SSH uses: appleboy/ssh-action@v1.0.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.SSH_KEY }} script: | docker stop my-app || true docker rm my-app || true docker run -d -p 80:3000 --name my-app my-app 
Enter fullscreen mode Exit fullscreen mode

Step 2: Add Secrets in GitHub
Go to your repo → Settings → Secrets → Actions and add:

  • HOST → your server IP
  • USERNAME → SSH username
  • SSH_KEY → your private key (paste the content)

5. Auto-Deploy to Production (Example with Docker + Nginx)

If you have Nginx configured as a reverse proxy on your server, this action will:

  • Build and push Docker container
  • Restart the service via SSH
  • Your live site updates in seconds after every push
    You can enhance it further using:

  • Slack notifications

  • Docker Hub or GitHub Container Registry

  • Rollback logic with tagged deployments

  1. Key Stats & Interesting Facts

7. FAQs

Q: Is GitHub Actions free?
A: Yes, for public repositories. Private repos have generous free tier limits.

Q: Can I deploy to multiple environments (staging, prod)?
A: Absolutely. You can use if: conditionals or separate workflows.

Q: Does it work with non-GitHub servers?
A: Yes. You can deploy to any server via SSH, FTP, Docker, Kubernetes, etc.

8. Key Takeaways

  • GitHub Actions enables native, integrated CI/CD with minimal config.
  • It supports any stack: Node.js, Python, Go, Docker, Kubernetes, and more.
  • Secrets management is built-in for secure deployments.
  • You can deploy to any environment — local, cloud, or hybrid.

9. Conclusion

Gone are the days of bulky CI servers and manual deployment scripts. With GitHub Actions, you can streamline your entire DevOps workflow inside your repository.
Whether you're a solo developer or managing a team, CI/CD is no longer optional — it's essential. And with GitHub Actions, it's also accessible.

About the Author:_ Rajan is a DevOps Engineer at AddWebSolution, specializing in automation infrastructure, Optimize the CI/CD Pipelines and ensuring seamless deployments._

Top comments (0)