从昨天晚上到今天上午,才把这个网站给掰扯明白,更换了主题,并且由原来的git提交静态文件,改成了 Actions Workflow 的方式部署。
更换主题
原来用的 tranquilty 主题,今天换了一个更简洁的主题
minimalism
Github Action Workflow
我的理解这个东西就是 jekenis 的部署应用。
过程
期间各种失败,网络问题、yml文件代码错误、文件问题等等,能遇到的全遇到了。
网络问题
不多说了,墙内网络,提交代码错误,但是很奇怪,通过 vscode 自带的 git 管理工具就可以,这个也算有解决方式。
文件安全问题

解决方案 是点击错误信息中的链接,在页面中选择运行即可。
- workflow代码配置错误
一开始是缺少deploy-pages的步骤,导致发布了十几次,但是访问页面始终无变化,通过 deepseek一步步的问才最终解决。
然后是报下面这个提示错误,最后才知道,github 默认部署的jekyll应用,需要声明改工程不是 jekyll,通过增加 touch public/.nojekyll 才解决。
1
| Error: Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.
|
workflow文件
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| name: Deploy Hexo to GitHub Pages
on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 with: submodules: true
- name: Setup Node.js uses: actions/setup-node@v3 with: node-version: 20
- name: Cache node modules uses: actions/cache@v3 id: cache-node-modules with: path: node_modules key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Install dependencies run: | npm install -g hexo-cli # 全局安装 Hexo CLI npm install # 安装项目依赖
- name: Generate static files run: | hexo clean # 清理旧文件 hexo generate # 生成静态文件 touch public/.nojekyll # 在构建后执行此命令
- name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public publish_branch: gh-pages commit_message: 'Deploy via GitHub Actions'
- name: Upload GitHub Pages artifact uses: actions/upload-pages-artifact@v3 with: name: github-pages path: ./public
deploy: needs: build permissions: pages: write id-token: write 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 with: artifact_name: github-pages
|