IT评测·应用市场-qidao123.com技术社区
标题:
【前端】Hexo 摆设指南_hexo-deploy-git·GitHub Actions·Git Hooks
[打印本页]
作者:
万万哇
时间:
2025-4-3 00:36
标题:
【前端】Hexo 摆设指南_hexo-deploy-git·GitHub Actions·Git Hooks
最新内容 & 更好的阅读体验
高速访问:https://wiki.dwj601.cn/front-end/hexo/hexo-deployment/
永世链接:https://explorer-dong.github.io/front-end/hexo/hexo-deployment/
媒介
一图胜千言:
基于 hexo-deploy-git
见:https://wiki.dwj601.cn/front-end/hexo/build-your-own-website-with-hexo/#摆设云端。
基于 GitHub Actions
该方法可以使用 GitHub Actions 的 CI/CD 功能,省去「当地构建」与「手动摆设」的操作,让 GitHub 平台帮助我们完成这两步操作,从而让我们只需要像维护项目代码一样专注于内容创作与版本管理,而无需关心其他任何事变。下面以「源码和站点同属一个仓库」的景象为例先容详细地操作与工作流配置。
1)创建一个空 GitHub 仓库、创建一个鉴权 token(该 token 可以让 GitHub Actions 以你的身份操作你的仓库)、赋予 GitHub Actions 读写权限
创建一个鉴权 token:头像 >> Settings >> Developer settings >> Personal access tokens >> Tokens (classic)
赋予 GitHub Actions 读写权限:Settings >> Actions >> General >> Workflow permissions
2)初始化一个博客项目
hexo init
复制代码
3)编辑 _config.yml 文件中的 url 字段
url: https://explorer-dong.github.io/demo-github-actions
复制代码
4)创建工作流文件 .github/workflows/bot.yml 并编辑如下内容
[code]name: Build and Deploy
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 相当于 git clone 到服务器
- name: Checkout
欢迎光临 IT评测·应用市场-qidao123.com技术社区 (https://dis.qidao123.com/)
Powered by Discuz! X3.4