<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[基于分支的版本号管理方案]]></title><description><![CDATA[<h1>基于分支的版本号管理方案</h1>
<h2>概述</h2>
<p dir="auto">NuGet 组件的版本号管理现在根据分支自动选择不同的环境配置文件，实现开发和生产环境的版本号隔离。</p>
<h2>分支与环境映射</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>分支类型</th>
<th>环境标识符</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>master</code> / <code>main</code></td>
<td><code>production</code></td>
<td>生产环境版本号</td>
</tr>
<tr>
<td><code>develop</code> / <code>next</code></td>
<td><code>development</code></td>
<td>开发环境版本号</td>
</tr>
<tr>
<td><code>feature/*</code> / <code>bugfix/*</code> / <code>fix/*</code></td>
<td><code>development</code></td>
<td>功能开发分支，使用开发环境版本号</td>
</tr>
<tr>
<td><code>hotfix/*</code></td>
<td><code>production</code></td>
<td>紧急修复分支，使用生产环境版本号</td>
</tr>
<tr>
<td>其他分支</td>
<td><code>development</code></td>
<td>默认使用开发环境版本号</td>
</tr>
</tbody>
</table>
<h2>URL 结构</h2>
<h3>下载 Directory.Build.props</h3>
<pre><code>${SHARED_VERSION_BASE_URL}/${PRODUCT_NAME}/${ENVIRONMENT}/urls.txt
</code></pre>
<p dir="auto">示例：</p>
<ul>
<li>生产环境：<code>https://version.lodatone.com/StoreManage/production/urls.txt</code></li>
<li>开发环境：<code>https://version.lodatone.com/StoreManage/development/urls.txt</code></li>
</ul>
<h3>更新版本号 API</h3>
<pre><code>${SHARED_VERSION_BASE_URL}/updateversion/${PRODUCT_NAME}/${COMPONENT_NAME}/${VERSION_ID}/${ENVIRONMENT}
</code></pre>
<p dir="auto">示例：</p>
<ul>
<li>生产环境：<code>https://version.lodatone.com/updateversion/StoreManage/Loda.Abp.StoreManage.Basic/2855.2026.103.58596/production</code></li>
<li>开发环境：<code>https://version.lodatone.com/updateversion/StoreManage/Loda.Abp.StoreManage.Basic/2855.2026.103.58596/development</code></li>
</ul>
<h2>工作流程</h2>
<h3>开发分支推送</h3>
<ol>
<li>开发者在 <code>feature/TG-1423-discount-bug</code> 分支提交代码</li>
<li>CI 自动判断分支类型 → <code>development</code></li>
<li>下载开发环境的 <code>Directory.Build.props</code></li>
<li>构建并推送 NuGet 包</li>
<li>更新开发环境的版本号</li>
<li>其他开发分支下次构建时自动使用新版本号</li>
</ol>
<h3>生产分支推送</h3>
<ol>
<li>代码合并到 <code>master</code> 分支</li>
<li>CI 自动判断分支类型 → <code>production</code></li>
<li>下载生产环境的 <code>Directory.Build.props</code></li>
<li>构建并推送 NuGet 包</li>
<li>更新生产环境的版本号</li>
<li>生产环境的其他项目使用新版本号</li>
</ol>
<h2>服务端配置</h2>
<h3>目录结构</h3>
<pre><code>wwwroot/
├── StoreManage/
│   ├── production/
│   │   ├── Directory.Build.props
│   │   ├── urls.txt
│   │   └── version-numbers/*.props
│   └── development/
│       ├── Directory.Build.props
│       ├── urls.txt
│       └── version-numbers/*.props
</code></pre>
<h3>API 端点</h3>
<p dir="auto">控制器需要支持新的路由格式：</p>
<pre><code class="language-csharp">[HttpGet]
[Route("{product}/{module}/{version}/{environment}")]
public IActionResult UpdateVersion(string product, string module, string version, string environment)
</code></pre>
<h2>优势</h2>
<ol>
<li><strong>环境隔离</strong>：开发和生产环境的版本号互不干扰</li>
<li><strong>自动化</strong>：根据分支自动选择环境，无需手动配置</li>
<li><strong>灵活性</strong>：支持多种分支命名规范</li>
<li><strong>向后兼容</strong>：保持对旧版本 API 的兼容</li>
</ol>
]]></description><link>https://talk.loda.net/topic/36/基于分支的版本号管理方案</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 08:39:59 GMT</lastBuildDate><atom:link href="https://talk.loda.net/topic/36.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Jan 2026 17:37:39 GMT</pubDate><ttl>60</ttl></channel></rss>