Skip to content

Commit dc8b8bd

Browse files
committed
🚀 releasing version 2.1.0 @ 2021-02-05 19:50
[skip ci]
1 parent 2274b85 commit dc8b8bd

File tree

7 files changed

+69
-24
lines changed

7 files changed

+69
-24
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ This project was forked from version 1.7.4 of [mbed-tools-ci-scripts](https://gi
1313

1414
[//]: # (begin_release_notes)
1515

16+
"2.1.0" (2021-02-05)
17+
====================
18+
19+
Features
20+
--------
21+
22+
- Print new version on `cd-generate-news` (#20210205180027)
23+
24+
1625
"2.0.1" (2021-02-05)
1726
====================
1827

continuous_delivery_scripts/_version.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
1111
This file is autogenerated, do not modify by hand.
1212
"""
13-
__version__ = "2.0.1"
14-
COMMIT = "71988b8e886b9f6ee33048accb3ea91d63776645"
13+
__version__ = "2.1.0"
14+
COMMIT = "2274b850c0ee1a2f23a2d3e52eab33749cde8c49"
1515
MAJOR = 2
16-
MINOR = 0
17-
PATCH = 1
16+
MINOR = 1
17+
PATCH = 0

docs/generate_news.html

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ <h1 class="title">Module <code>continuous_delivery_scripts.generate_news</code><
4747
from continuous_delivery_scripts.utils.configuration import configuration, ConfigurationVariable
4848
from continuous_delivery_scripts.utils.logging import log_exception, set_log_level
4949
from continuous_delivery_scripts.utils.filesystem_helpers import cd
50-
from typing import Optional, Tuple
50+
from typing import Optional, Tuple, Dict
5151

5252
logger = logging.getLogger(__name__)
5353

5454

55-
def version_project(commit_type: CommitType) -&gt; Tuple[bool, Optional[str]]:
55+
def version_project(commit_type: CommitType) -&gt; Tuple[bool, Optional[str], Dict[str, str]]:
5656
&#34;&#34;&#34;Versions the project.
5757

5858
Args:
@@ -63,12 +63,12 @@ <h1 class="title">Module <code>continuous_delivery_scripts.generate_news</code><
6363
(is new version, the new version)
6464
&#34;&#34;&#34;
6565
use_news_files = commit_type in [CommitType.BETA, CommitType.RELEASE]
66-
is_new_version, new_version = _calculate_version(commit_type, use_news_files)
66+
is_new_version, new_version, version_elements = _calculate_version(commit_type, use_news_files)
6767
_generate_changelog(new_version, use_news_files)
68-
return is_new_version, new_version
68+
return is_new_version, new_version, version_elements
6969

7070

71-
def _calculate_version(commit_type: CommitType, use_news_files: bool) -&gt; Tuple[bool, Optional[str]]:
71+
def _calculate_version(commit_type: CommitType, use_news_files: bool) -&gt; Tuple[bool, Optional[str], Dict[str, str]]:
7272
&#34;&#34;&#34;Calculates the version for the release.
7373

7474
eg. &#34;0.1.2&#34;
@@ -99,13 +99,44 @@ <h1 class="title">Module <code>continuous_delivery_scripts.generate_news</code><
9999
# Autoversion second returned value is not actually the new version
100100
# There seem to be a bug in autoversion.
101101
# This is why the following needs to be done to determine the version
102-
for k, v in updates.items():
103-
if &#34;version&#34; in str(k).lower():
104-
new_version = updates[k]
102+
version_elements = _get_version_elements(updates)
103+
new_version = version_elements.get(auto_version_tool.Constants.VERSION_FIELD, new_version)
105104
is_new_version = old != new_version
106105
logger.info(&#34;:: Determining the new version&#34;)
107106
logger.info(f&#34;Version: {new_version}&#34;)
108-
return is_new_version, new_version
107+
return is_new_version, new_version, version_elements
108+
109+
110+
def _update_version_string(
111+
commit_type: CommitType, new_version: Optional[str], version_elements: Dict[str, str]
112+
) -&gt; Optional[str]:
113+
&#34;&#34;&#34;Updates the version string for development releases.
114+
115+
Args:
116+
commit_type: commit type
117+
new_version: the new version
118+
version_elements: version elements
119+
&#34;&#34;&#34;
120+
if commit_type == CommitType.DEVELOPMENT:
121+
return &#34;%s-%s.%s&#34; % (
122+
new_version,
123+
auto_version_tool.config.BUILD_TOKEN,
124+
version_elements.get(auto_version_tool.Constants.COMMIT_FIELD),
125+
)
126+
return new_version
127+
128+
129+
def _get_version_elements(native_version_elements: Dict[str, str]) -&gt; Dict[str, str]:
130+
&#34;&#34;&#34;Determines the different version elements.
131+
132+
Args:
133+
native_version_elements: native version elements as understood by autoversion
134+
&#34;&#34;&#34;
135+
return {
136+
key: native_version_elements[native]
137+
for native, key in auto_version_tool.config.key_aliases.items()
138+
if native in native_version_elements
139+
}
109140

110141

111142
def _generate_changelog(version: Optional[str], use_news_files: bool) -&gt; None:
@@ -135,7 +166,10 @@ <h1 class="title">Module <code>continuous_delivery_scripts.generate_news</code><
135166
set_log_level(args.verbose)
136167

137168
try:
138-
version_project(CommitType.parse(args.release_type))
169+
commit_type = CommitType.parse(args.release_type)
170+
is_new_version, new_version, version_elements = version_project(commit_type)
171+
version_to_print = _update_version_string(commit_type, new_version, version_elements)
172+
print(version_to_print)
139173
except Exception as e:
140174
log_exception(logger, e)
141175
sys.exit(1)
@@ -172,14 +206,17 @@ <h2 class="section-title" id="header-functions">Functions</h2>
172206
set_log_level(args.verbose)
173207

174208
try:
175-
version_project(CommitType.parse(args.release_type))
209+
commit_type = CommitType.parse(args.release_type)
210+
is_new_version, new_version, version_elements = version_project(commit_type)
211+
version_to_print = _update_version_string(commit_type, new_version, version_elements)
212+
print(version_to_print)
176213
except Exception as e:
177214
log_exception(logger, e)
178215
sys.exit(1)</code></pre>
179216
</details>
180217
</dd>
181218
<dt id="continuous_delivery_scripts.generate_news.version_project"><code class="name flex">
182-
<span>def <span class="ident">version_project</span></span>(<span>commit_type: <a title="continuous_delivery_scripts.utils.definitions.CommitType" href="utils/definitions.html#continuous_delivery_scripts.utils.definitions.CommitType">CommitType</a>) ‑> Tuple[bool, Union[str, NoneType]]</span>
219+
<span>def <span class="ident">version_project</span></span>(<span>commit_type: <a title="continuous_delivery_scripts.utils.definitions.CommitType" href="utils/definitions.html#continuous_delivery_scripts.utils.definitions.CommitType">CommitType</a>) ‑> Tuple[bool, Union[str, NoneType], Dict[str, str]]</span>
183220
</code></dt>
184221
<dd>
185222
<div class="desc"><p>Versions the project.</p>
@@ -194,7 +231,7 @@ <h2 id="returns">Returns</h2>
194231
<summary>
195232
<span>Expand source code</span>
196233
</summary>
197-
<pre><code class="python">def version_project(commit_type: CommitType) -&gt; Tuple[bool, Optional[str]]:
234+
<pre><code class="python">def version_project(commit_type: CommitType) -&gt; Tuple[bool, Optional[str], Dict[str, str]]:
198235
&#34;&#34;&#34;Versions the project.
199236

200237
Args:
@@ -205,9 +242,9 @@ <h2 id="returns">Returns</h2>
205242
(is new version, the new version)
206243
&#34;&#34;&#34;
207244
use_news_files = commit_type in [CommitType.BETA, CommitType.RELEASE]
208-
is_new_version, new_version = _calculate_version(commit_type, use_news_files)
245+
is_new_version, new_version, version_elements = _calculate_version(commit_type, use_news_files)
209246
_generate_changelog(new_version, use_news_files)
210-
return is_new_version, new_version</code></pre>
247+
return is_new_version, new_version, version_elements</code></pre>
211248
</details>
212249
</dd>
213250
</dl>

docs/tag_and_release.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h1 class="title">Module <code>continuous_delivery_scripts.tag_and_release</code
7373

7474
&#34;&#34;&#34;
7575
get_language_specifics().check_credentials()
76-
is_new_version, version = version_project(mode)
76+
is_new_version, version, _ = version_project(mode)
7777
logger.info(f&#34;Current version: {version}&#34;)
7878
if not version:
7979
raise ValueError(&#34;Undefined version.&#34;)
@@ -252,7 +252,7 @@ <h2 id="args">Args</h2>
252252

253253
&#34;&#34;&#34;
254254
get_language_specifics().check_credentials()
255-
is_new_version, version = version_project(mode)
255+
is_new_version, version, _ = version_project(mode)
256256
logger.info(f&#34;Current version: {version}&#34;)
257257
if not version:
258258
raise ValueError(&#34;Undefined version.&#34;)

docs/third_party_IP_report.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
</head>
6666
<body>
6767
<h1>Project's 3rd party IP report</h1>
68-
<p><i>2021-02-05 01:19:20.300205</i></p>
68+
<p><i>2021-02-05 19:50:14.421855</i></p>
6969
<h2>Summary</h2>
7070
<table>
7171
<thead>

docs/third_party_IP_report.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
3rd party IP report for continuous-delivery-scripts
22

3-
2021-02-05 01:19:20.300205
3+
2021-02-05 19:50:14.421855
44

55
# Summary:
66
Licence compliance: Compliant

news/20210205180027.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)