Step 1 把 Hexo 代码放到 GitHub 的仓库里
Step 2 在 .github/workflows
中创建一个 deploy.yml
文件
Step 3 在刚刚创建的文件中输入以下代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 name: Hexo Blog Delopy on: push: branches: - master jobs: build: runs-on: ubuntu-latest steps: - name: Checkout Repository master branch uses: actions/checkout@master - name: Setup Node.js uses: actions/setup-node@master with: node-version: "14" - name: Setup Hexo run: | npm install hexo-cli -g - name: Deploy Hexo run: | hexo clean hexo generate hexo deploy - name: Setup Git Infomation run: | git config --global user.name '<你的GitHub用户名>' git config --global user.email '<你的GitHub邮箱>' - name: Deploy to GitHub Pages uses: crazy-max/ghaction-github-pages@v2 with: target_branch: gh-pages build_dir: public fqdn: keep_history: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Step 4 更改 deploy.yml
中的两个字段:
<你的GitHub用户名>
<你的GitHub邮箱>