Update _config.anzhiyu.yml #34
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 Hexo to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main # 当推送到 main 分支时触发 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: false # 禁用子模块检查 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '20' | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Install Hexo Git Deployer | |
| run: | | |
| npm install hexo-deployer-git --save | |
| npm install hexo-cli -g | |
| - name: Clean and Generate Static Files | |
| run: | | |
| hexo clean | |
| hexo generate | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Deploy to GitHub Pages | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| run: | | |
| cd public/ | |
| git init | |
| git add -A | |
| git commit -m "Create by workflows" | |
| git remote add origin https://${{ secrets.GH_TOKEN }}@github.com/wwzhishi/hexo.git | |
| git push origin HEAD:gh-pages -f |