Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Cách mình setup CI/CD đơn giản với GitHub Actions

Description and use

Simple CI/CD workflow for Node.js on GitHub Actions: tests, lint, build, SSH deployment, and automated releases.

Problem

Thiết lập CI/CD đơn giản cho dự án Node.js trên GitHub Actions, bao gồm chạy test, lint, deploy, và release.

Outcome

Pipeline tự động chạy test, lint, build, deploy và release, giảm thiểu lỗi thủ công và tăng tốc độ phát triển.

Workflow

  • Checkout mã nguồn
  • Cài đặt Node.js (v20) và cache npm
  • Chạy npm ci, test, lint
  • Deploy tới server qua SSH khi branch main
  • Chạy test trên nhiều phiên bản Node (18,20,22)
  • Cache node_modules để tăng tốc build
  • Chạy workflow khi có tag release và tạo release

Evidence

GitHub Actions miễn phí cho public repo và có 2000 phút/tháng cho private repo.

Source

Deploy to server via SSH using appleboy/ssh-action

Source

Create Release using softprops/action-gh-release

Source

  • Record date: 2026-09-22T17:45:44.017Z