Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
/ githubioStart Public archive

使用githubio,利用github钩子来自动部署repository项目

Notifications You must be signed in to change notification settings

leij1ang/githubioStart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

哈,github也有免费的ci/cd啦,此项目就此退休,拜拜

githubioStart

利用github.io和github钩子展示前端repository项目

首先你得有一台部署服务器(linux)

服务器的租赁此处不展开讨论

服务器上要有git客户端、node.js或其他后台语言,此处将以nodejs举例

安装教程自行搜索

利用ssh绑定服务器git与github

  1. 生成 SSH key

    ssh-keygen -t rsa

    随后不停回车下去就行了

    cd .ssh

    里面有两个文件,分别名叫id_rsa、id_rsa.pub,这就是密钥和公钥

  2. 添加 SSH key 登录你的github 进入https://github.com/settings/keys,选择右上方 New SSH key

     title可以随意填写
     key则将生成的公钥内容复制进去,即id_rsa.pub文件内容
    

    选择 Add SSH key保存

  3. github webhook

    进入https://github.com/${前端项目仓库}/settings/hooks/new

    选择New webhook

    Payload URL填写服务器ip和准备打开的端口+'/deploy',如http://110.110.110.110:6666/deploy

    Content type选择application/json

    选择Just the push event来监听push事件

    选择Add webhook保存

  4. 创建github.io仓库

    新建一个仓库,名称为${用户名}.github.io

    进入https://github.com/${用户名}.github.io/settings,找到GitHub Pages

    source选择master branch后点击保存

  5. 将此项目拷贝至服务器上

    执行以下几个步骤

    1. sh init.sh根据提示输入你的前端仓库名称,用户名(注意大小写),webhook端口号
    2. 根据需求打开deploy.sh修改脚本,此项目以vue-element-admin部署流程为例为例
    3. node deploy.js > deploy.log 2>deployErr.log &监听hook

About

使用githubio,利用github钩子来自动部署repository项目

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published