GitHub Actions Workflow
Vibe Prompt
「幫我建立 GitHub Actions Workflow:Node.js 20,推送到 main 時自動 npm ci、lint、test、build。」
name: CI Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-output
path: .next/
Vibe Prompt
「幫我解釋 GitHub Actions 的 runner、job、step、action 的關係,用生活比喻說明。」
本日總結
- ✅ GitHub Actions 基本結構
- ✅ CI Pipeline 範例
- ✅ Cache 加速依賴安裝