Sync all docs with public (2026-03-29) #22
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: Deploy Mingjian Website | ||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| schedule: | ||
| - cron: '0 9 * * *' | ||
| jobs: | ||
| build-and-deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 0 | ||
| - name: Setup Hugo | ||
| uses: peaceiris/actions-hugo@v2 | ||
| with: | ||
| hugo-version: 'latest' | ||
| extended: true | ||
| - name: Build website | ||
| run: | | ||
| echo "🏗️ Building Mingjian website..." | ||
| hugo --quiet | ||
| echo "✅ Build completed" | ||
| - name: Configure Git | ||
| run: | | ||
| git config --global user.name "GitHub Actions" | ||
| git config --global user.email "actions@github.com" | ||
| - name: Deploy to docs directory | ||
| run: | | ||
| echo "🚀 Deploying to docs directory..." | ||
| # Copy instead of move to preserve existing files | ||
| rm -rf docs | ||
| cp -r public docs | ||
| # Add GitHub Pages files | ||
| echo "mingjian-ai.github.io" > docs/CNAME | ||
| touch docs/.nojekyll | ||
| # 检查是否有更改 | ||
| if git diff --quiet docs/; then | ||
| echo "📭 No changes to deploy" | ||
| else | ||
| echo "📦 Changes detected, committing..." | ||
| git add docs/ | ||
| git commit -m "GitHub Actions: Auto-deploy website $(date -u '+%Y-%m-%d %H:%M:%S') | ||
| Build details: | ||
| - Hugo version: $(hugo version) | ||
| - Build time: $(date -u '+%Y-%m-%d %H:%M:%S UTC') | ||
| - Triggered by: ${{ github.event_name }} | ||
| - Commit: ${{ github.sha }}" | ||
| git push origin master | ||
| echo "✅ Deployment completed" | ||
| fi | ||
| - name: Verify deployment | ||
| run: | | ||
| echo "🔍 Verifying deployment..." | ||
| if [ -d "docs" ]; then | ||
| echo "✅ docs directory exists" | ||
| else | ||
| echo "❌ docs directory not found" | ||
| exit 1 | ||