update #1455
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy to EdgeOne | |
| # 向主干分支推送代码时触发部署 | |
| on: | |
| push: | |
| branches: | |
| - astro-pure-v4_0_3 | |
| workflow_dispatch: # 允许手动触发 | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Setup Python (for font subsetting) | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install fonttools | |
| run: | | |
| pip install fonttools brotli | |
| # 验证安装 - 使用 Python 导入模块的方式验证 | |
| python -c "import fontTools; print('✅ fonttools 版本:', fontTools.__version__)" || { | |
| echo "❌ fonttools 安装失败" | |
| exit 1 | |
| } | |
| # 验证 subset 模块是否可用 | |
| python -m fontTools.subset --help > /dev/null 2>&1 || { | |
| echo "❌ fontTools.subset 模块不可用" | |
| exit 1 | |
| } | |
| echo "✅ fonttools 安装成功" | |
| - name: Install dependencies | |
| run: bun install | |
| # edgeone CLI 已包含在 devDependencies 中 | |
| - name: Build project | |
| run: bun run build | |
| - name: Generate font subset (post-build script) | |
| run: node scripts/subset-fonts.js | |
| # 如果字体子集化失败,会终止整个流程(已移除 continue-on-error) | |
| - name: Verify build output | |
| run: | | |
| echo "📦 Build output directory contents:" | |
| ls -lh dist/ | head -20 | |
| echo "" | |
| echo "🔤 Font files:" | |
| ls -lh public/fonts/ 2>/dev/null || echo "No font files found" | |
| - name: Deploy to EdgeOne Pages | |
| run: bunx edgeone pages deploy dist -n ${{ secrets.EDGEONE_PROJECT_NAME }} -t ${{ secrets.EDGEONE_API_TOKEN }} | |
| env: | |
| EDGEONE_API_TOKEN: ${{ secrets.EDGEONE_API_TOKEN }} | |
| EDGEONE_PROJECT_NAME: ${{ secrets.EDGEONE_PROJECT_NAME }} |