π GitHub Actions & Automated CI/CD
NOTE
GitHub Actions turns your repository into a complete automation engine capable of building, testing, linting, auditing security, and deploying software directly in response to any Git lifecycle event.
ποΈ 1. GitHub Actions Architecture
graph TD Event["β‘ Event / Trigger<br/><i>(push, pull_request, schedule, workflow_dispatch)</i>"] --> Workflow["π Workflow (.github/workflows/*.yml)"] Workflow --> Job1["ποΈ Job 1: Lint & TypeCheck (ubuntu-latest)"] Workflow --> Job2["π§ͺ Job 2: Test Matrix (Node 18, 20, 22)"] Job1 --> Step1["Step: Checkout"] Job1 --> Step2["Step: Setup Node"] Job1 --> Step3["Step: Run Scripts"] Job2 --> Job3["π Job 3: Deploy to GitHub Pages (needs: [Job1, Job2])"]
Core Concepts:
- Workflows: Declarative YAML configuration files in
.github/workflows/. - Events (Triggers): Events that kick off a workflow run (
push,pull_request,workflow_dispatch,release,schedule). - Jobs: Sets of steps executed on the same runner machine. Jobs run concurrently by default.
- Runners: Virtual machine environments hosted by GitHub (
ubuntu-latest,windows-latest,macos-latest) or self-hosted. - Steps & Actions: Individual shell tasks (
run: ...) or packaged community actions (uses: actions/checkout@v4).
π 2. Production Workflow: Deploy Quartz to GitHub Pages
This repository uses the following battle-tested workflow in .github/workflows/deploy-gh-pages.yaml:
name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Dependencies
run: npm ci
- name: Install Quartz Plugins
run: npx quartz plugin install
- name: Build Quartz
run: npx quartz build
- name: Configure GitHub Pages
uses: actions/configure-pages@v4
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: public
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4π Official Documentation & References
- π Git SCM Official Documentation β Official Pro Git book and command manual.
- π GitHub Docs β Official guides on GitHub Actions, PRs, Security, and REST/GraphQL APIs.
- π¦ Conventional Commits 1.0.0 Specification β Official specification.
- π‘οΈ SonarCloud Documentation & Snyk Docs β Official SAST & SCA security docs.
π Second Brain Links
- Publish and customize documentation sites with GitHub Pages & Quartz v4.
- Integrate security and quality gates with Security & Code Quality.
- Trigger workflows remotely with GitHub CLI & API.