如何完成一次Apache的版本发布
理解Apache发布的内容和流程
总的来说,Source Release是Apache关注的重点,也是发布的必须内容;而Binary Release是可选项,Dubbo可以选择是否发布二进制包到Apache仓库或者发布到Maven中央仓库。
请参考以下链接,找到更多关于ASF的发布指南:
• Apache Release Policy
• Maven Release Info
本地构建环境准备
主要包括签名工具、Maven仓库认证相关准备
1. 安装GPG,参见 https://www.gnupg.org/download/index.html
如Mac OS
![](https://img.haomeiwen.com/i2509688/6da5c67f34f837cd.png)
2. 用gpg生成key
根据提示,生成key
![](https://img.haomeiwen.com/i2509688/a8eeb564aa8a572b.png)
查看key id
![](https://img.haomeiwen.com/i2509688/0bad1f8fd210e960.png)
如果有多个public key,设置默认key
~/.gnupg/gpg.conf
![](https://img.haomeiwen.com/i2509688/3bb2277be605afb8.png)
3. 设置Apache中央仓库
Dubbo项目的父pom为apache pom
![](https://img.haomeiwen.com/i2509688/0c72caac580b54ed.png)
添加以下内容到.m2/settings.xml
![](https://img.haomeiwen.com/i2509688/924dabeedd12c5d8.png)
![](https://img.haomeiwen.com/i2509688/4cfef5978419adc1.png)
打包&上传
1. 从主干分支拉取新分支作为发布分支,如现在要发布2.6.4版本,则从2.6.x拉出新分支2.6.4-release,此后2.6.4 Release Candidates涉及的修改及打标签等都在2.6.4-release分支进行,最终发布完成后合入主干分支。
2. 首先,在2.6.4-release分支验证maven组件打包、source源码打包、签名等是否都正常工作。
![](https://img.haomeiwen.com/i2509688/a6744a16e5992fc8.png)
3. 用maven-release-plugin发布
先用dryRun验证是否ok
![](https://img.haomeiwen.com/i2509688/b37d93248adfd411.png)
验证通过后,执行release:prepare
![](https://img.haomeiwen.com/i2509688/686f357361abf713.png)
执行release:perform,做正式发布
![](https://img.haomeiwen.com/i2509688/dfed263042cc2c3c.png)
准备Apache发布
1. 准备svn本机环境(Apache使用svn托管项目的发布内容)
2. 将dubbo checkout到本地目录
![](https://img.haomeiwen.com/i2509688/c6c589b40fe5bd55.png)
3. 当前发布版本为2.6.4,新建目录
![](https://img.haomeiwen.com/i2509688/a5a735d34a6d1f9c.png)
4. 添加public key到KEYS文件。KEYS主要是让参与投票的人在本地导入,用来校验sign的正确性
5. 拷贝Dubbo根目录下的source.zip包到svn本地仓库dubbo/2.6.4
6. 生成sha512签名
![](https://img.haomeiwen.com/i2509688/f2b2120aef8310c0.png)
7. 如果有binary release要同时发布
![](https://img.haomeiwen.com/i2509688/90f9f0a2baeee83b.png)
8. 提交到Apache svn
![](https://img.haomeiwen.com/i2509688/72b5a75bc38c6640.png)
验证Release Candidates
证环节包含但不限于以下内容和形式:
1. Check signatures and hashes are good
![](https://img.haomeiwen.com/i2509688/3c27dfb09a824b6f.png)
1. unzip dubbo-incubating-${release_version}-source-release.zip to the default directory and check the following:
• Directory with incubator in name
dubbo-incubating-${release_version}-bin-release
• DISCLAIMER file exists
• LICENSE and NOTICE file exists and contents are good
• All files and no binary files exist
• All files has standard ASF License header
• Can compile from source
• All unit tests can pass
![](https://img.haomeiwen.com/i2509688/84990595857e21be.png)
• Release candidates match with corresponding tags, you can find tag link and hash in vote email.
进入投票
投票分两个阶段:
1. Dubbo社区投票,发起投票邮件到dev@dubbo.apache.org。在社区开发者Review,并统计到3个同意发版的binding票后,即可进入下一阶段的投票。
2. Apache社区投票,发起投票邮件到general@apache.org。在Apache PMC Review,并统计到3个统一发版的binding票后,即可进行正式发布。
邮件模板:
![](https://img.haomeiwen.com/i2509688/5e8161e0342aa3ce.png)
正式发布
1. 提交https://dist.apache.org/repos/dist/dev/incubator/dubbo目录下的发布包到https://dist.apache.org/repos/dist/release/incubator/dubbo/,完成正式发布。
2. 发邮件到dev@dubbo.apache.org和general@apache.org,通知社区发布完成。
完成Maven Convenient Binary发布(可选)
apache.repository.org nexus仓库的权限已经申请,参见jira。
之前发布到maven仓库的atifacts都处于staging状态,用Apache id登录apache.repository.org,完成发布。
本文作者:中间件小哥
本文为云栖社区原创内容,未经允许不得转载。