feat: migrate website to site-src and add CI workflow #1
Workflow file for this run
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 & Deploy Website | ||
| on: | ||
| push: | ||
| branches: [ main, web-merge ] | ||
| # 只在网站改动或工作流改动时触发(可选) | ||
| paths: | ||
| - 'site-src/**' | ||
| - '.github/workflows/publish-website.yml' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| pages: write # 必须:允许部署到 Pages | ||
| id-token: write # 必须:OIDC 用于部署签名 | ||
| concurrency: | ||
| group: 'pages' | ||
| cancel-in-progress: true | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive # 如果 site-src 使用了子模块 | ||
| - name: Setup Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '3.2' | ||
| bundler-cache: true | ||
| working-directory: site-src | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Install Node deps | ||
| working-directory: site-src | ||
| run: | | ||
| npm ci || npm install | ||
| # 如需 Python(词云等),解开以下两步 | ||
| # - name: Setup Python | ||
| # uses: actions/setup-python@v5 | ||
| # with: | ||
| # python-version: '3.11' | ||
| # - name: Run Python helpers | ||
| # working-directory: site-src | ||
| # run: | | ||
| # pip install -r requirements.txt | ||
| # python make_wordcloud.py || true | ||
| - name: Install Jupyter | ||
| run: | | ||
| python3 -m pip install --upgrade pip | ||
| python3 -m pip install jupyter | ||
| - name: Build Jekyll (al-folio) | ||
| working-directory: site-src | ||
| run: | | ||
| bundle exec jekyll build -s . -d _site --trace --verbose | ||
| - name: Upload artifact to Pages | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: site-src/_site | ||
| deploy: | ||
| needs: build | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||