背景
最近在做一个项目,代码都已经托管到github上,准备走开源路线。 项目: 一个重大轮子: 基于mysql数据库binlog的增量订阅&消费
使用了github的issue tracker代码,本文记录一下如何使用github管理release notes,希望能给大家玩github的有所帮助。
过程
步骤1 (准备issue/milestone素材)
首先,需要先学会github issue/milestone的使用. 要做release notes,也得有最基本的issue素材。
github issue基本介绍:https://github.com/blog/831-issues-2-0-the-next-generation
1. 创建milestone
2. 创建issue(选择一个milestone)
这样基本上release相关的素材就已经准备完毕了.
步骤2 (准备github pages)
What are GitHub Pages? GitHub Pages are public webpages freely hosted and easily published through our site. You can publish online using the Automatic Page Generator. If you prefer to work locally you can use the GitHub for Mac and Windows apps, or the command line.
github pages介绍:
创建pages,我选择比较简单的,基于github automic generator,文档: https://help.github.com/articles/creating-pages-with-the-automatic-generator
进入自己工程的settings页面,点击Automatic Page Generator按钮,按照提示一步步下去即可,最后点击Publish,即发布完成.
自动生成后的链接地址为: username.github.com/reponame or orgname.github.com/reponame
步骤3 (准备release notes生成脚本)
1 下载之前生成的Git Pages,选择gh-pages分支
git clone git@github.com:xxxx.git -b gh-pages
2. 下载开源的releasenotes plugin:
git clone https://github.com/posabsolute/releasenotes.git
3. 合并
cp -R releasenotes/css releasenotes/js releasenotes/images gh-pages/ cp releasenotes/index.html gh-pages/release.html
4. 修改release.html相关参数
$(document).ready(function() { $("#releaseNotesContainer").releaseNotes({ milestonesShown : 10, // If you want to show private repo // You need to add repo credentials in api.php phpApi : false, phpApiPath : '/', showDescription : true, showComments : true, // Used if phpAPI is false repo : 'canal', //改成己的repo name username : 'otter-projects' //改成自己的username或者orgname }); });
5. 收工,ci & push代码
releasenotes plugins的基本原理
- 利用api.github.com提供的restful接口,相关api说明: http://developer.github.com/v3/issues/
事例: https://api.github.com/repos/otter-projects/canal/milestones
最后
验收结果,比如我的工程: http://otter-projects.github.com/canal/release.html
效果图: