Update hello-world.md (#2) #50
This file contains 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 Hexo Site | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true # 确保子模块也被检出 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # 使用Node.js 20版本 | |
- name: Install dependencies | |
run: | | |
npm install | |
npm install -g hexo-cli # 全局安装Hexo CLI | |
npm install hexo-renderer-pug hexo-renderer-stylus --save # 安装必要的渲染器 | |
- name: Install Butterfly theme dependencies | |
run: | | |
cd themes/butterfly | |
npm install # 确保主题的特定依赖也被安装 | |
- name: Generate static files | |
run: hexo generate | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.DEPLOY_TOKEN }} | |
publish_dir: ./public | |
- name: List output files | |
run: ls -alh ./public # 列出public目录下的文件,用于调试 |