ไปป์ไลน์การสร้าง
หน้านี้อธิบายวิธีที่ repository เนื้อหาใช้แพ็กเกจ npm @f5-sales-demo/docs-theme เพื่อสร้างไซต์เอกสารที่มีการสร้างแบรนด์อย่างสมบูรณ์
สถาปัตยกรรม
หัวข้อที่มีชื่อว่า “สถาปัตยกรรม”┌─────────────────┐│ Content Repo ││ (docs/ folder) │└────────┬────────┘ │ ▼┌───────────────────────────┐│ f5xc-docs-builder ││ (Docker image) ││ ││ npm install ││ @f5-sales-demo/docs-theme ─────┐ ││ ▼ ││ node_modules/ ││ @f5-sales-demo/docs-theme/ ││ ├── config.ts ││ ├── index.ts ││ ├── fonts/ ││ ├── styles/ ││ ├── assets/ ││ └── components/ ││ ││ Astro Build │└─────────────┬─────────────┘ ▼┌───────────────────────────┐│ Astro Build Output ││ (static HTML/CSS) │└─────────────┬─────────────┘ ▼┌───────────────────────────┐│ GitHub Pages │└───────────────────────────┘กระบวนการสร้างทีละขั้นตอน
หัวข้อที่มีชื่อว่า “กระบวนการสร้างทีละขั้นตอน”- การ push ของ content repo — การ push ไปยัง
main(หรือการส่งคำสั่งด้วยตนเอง) จะเรียกใช้ workflow การปรับใช้ GitHub Pages - Reusable workflow — workflow ของ content repo จะเรียกใช้ builder:
jobs:docs:uses: f5-sales-demo/docs-control/.github/workflows/github-pages-deploy.yml@main
- Docker builder ทำงาน — Docker image
f5xc-docs-builderมีธีมที่ติดตั้งไว้ล่วงหน้าผ่าน npm เมื่อถึงเวลาสร้าง จะ:- คัดลอก
astro.config.mjsและcontent.config.tsจากnode_modules/@f5-sales-demo/docs-theme/ไปยัง root ของโปรเจกต์ Astro - คัดลอกไฟล์
docs/ของ content repo ไปยังsrc/content/docs/
- คัดลอก
- Astro build — Astro อ่าน config ซึ่งเรียกใช้
createF5xcDocsConfig()factory จะแก้ไข asset ของธีมทั้งหมดผ่าน npm package specifier (เช่น@f5-sales-demo/docs-theme/styles/custom.css) - การปรับใช้ — ไซต์แบบ static ที่สร้างแล้วจะถูกปรับใช้บน GitHub Pages
ข้อกำหนดของ Content Repo
หัวข้อที่มีชื่อว่า “ข้อกำหนดของ Content Repo”content repository ต้องการเพียง:
- ไดเรกทอรี
docs/ที่มีไฟล์ Markdown (.md) หรือ MDX (.mdx) - GitHub Actions workflow ที่เรียกใช้ builder
Workflow ขั้นต่ำ
หัวข้อที่มีชื่อว่า “Workflow ขั้นต่ำ”name: GitHub Pages Deployon: push: branches: [main] workflow_dispatch:
permissions: contents: read pages: write id-token: write
concurrency: group: pages cancel-in-progress: true
jobs: docs: uses: f5-sales-demo/docs-control/.github/workflows/github-pages-deploy.yml@mainนี่คือ workflow เดียวกับที่ repository ธีมนี้ใช้เพื่อสร้างเอกสารที่คุณกำลังอ่านอยู่
การแก้ไข Path
หัวข้อที่มีชื่อว่า “การแก้ไข Path”path ทั้งหมดในธีมใช้ npm package specifier ซึ่งแก้ไขผ่าน map exports ใน package.json:
// CSS — resolved from node_modules'@f5-sales-demo/docs-theme/fonts/font-face.css''@f5-sales-demo/docs-theme/styles/custom.css'
// Components — resolved from node_modules'@f5-sales-demo/docs-theme/components/Footer.astro''@f5-sales-demo/docs-theme/components/Banner.astro'
// Assets — resolved from node_modules'@f5-sales-demo/docs-theme/assets/github-avatar.png'ไม่มีไดเรกทอรี ./theme/ ใน build workspace Docker builder ติดตั้งธีมเป็น npm dependency ปกติ และ Astro แก้ไข specifier ทั้งหมดผ่าน node_modules
การแพร่กระจายการเปลี่ยนแปลง
หัวข้อที่มีชื่อว่า “การแพร่กระจายการเปลี่ยนแปลง”การเปลี่ยนแปลงธีมจะแพร่กระจายผ่านการอัปเดตแพ็กเกจ npm:
- การเปลี่ยนแปลงถูก merge ไปยัง
mainใน@f5-sales-demo/docs-theme - Docker builder image ถูกสร้างใหม่พร้อมแพ็กเกจที่อัปเดต
- ครั้งถัดไปที่ workflow ของ content repo ใดๆ ทำงาน จะใช้ builder image ที่อัปเดตแล้ว
- Astro build รับฟอนต์ สไตล์ โลโก้ ส่วนประกอบ และปลั๊กอินที่อัปเดตแล้ว
- ไซต์ของ content repo ปรับใช้พร้อมธีมใหม่
content repo จะได้รับธีมล่าสุดที่รวมอยู่ใน Docker image เสมอ ซึ่งช่วยให้มั่นใจในความสม่ำเสมอของรูปลักษณ์ในทุกไซต์ แต่หมายความว่าการเปลี่ยนแปลงธีมควรได้รับการทดสอบอย่างรอบคอบก่อน merge