Skip to content

Commit ea90d2e

Browse files
committed
change versioning
1 parent 9a9e93a commit ea90d2e

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

build/azure-pipeline.pre-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ extends:
8383
displayName: Update telemetry in package.json
8484

8585
- script: python ./build/update_ext_version.py --for-publishing
86-
displayName: Update build number
86+
displayName: Validate version number
8787

8888
- bash: |
8989
mkdir -p $(Build.SourcesDirectory)/python-env-tools/bin

build/test_update_ext_version.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99

1010
TEST_DATETIME = "2022-03-14 01:23:45"
1111

12-
# The build ID is calculated via:
13-
# "1" + datetime.datetime.strptime(TEST_DATETIME,"%Y-%m-%d %H:%M:%S").strftime('%j%H%M')
14-
EXPECTED_BUILD_ID = "10730123"
15-
1612

1713
def create_package_json(directory, version):
1814
"""Create `package.json` in `directory` with a specified version of `version`."""
@@ -71,7 +67,7 @@ def test_invalid_args(tmp_path, version, args):
7167
["--build-id", "999999999999"],
7268
("1", "1", "999999999999", "rc"),
7369
),
74-
("1.1.0-rc", [], ("1", "1", EXPECTED_BUILD_ID, "rc")),
70+
("1.1.0-rc", [], ("1", "1", "0", "rc")),
7571
(
7672
"1.0.0-rc",
7773
["--release"],
@@ -80,7 +76,7 @@ def test_invalid_args(tmp_path, version, args):
8076
(
8177
"1.1.0-rc",
8278
["--for-publishing"],
83-
("1", "1", EXPECTED_BUILD_ID, ""),
79+
("1", "1", "0", ""),
8480
),
8581
(
8682
"1.0.0-rc",
@@ -95,7 +91,7 @@ def test_invalid_args(tmp_path, version, args):
9591
(
9692
"1.1.0-rc",
9793
[],
98-
("1", "1", EXPECTED_BUILD_ID, "rc"),
94+
("1", "1", "0", "rc"),
9995
),
10096
],
10197
)

build/update_ext_version.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ def main(package_json: pathlib.Path, argv: Sequence[str]) -> None:
7979
)
8080

8181
print(f"Updating build FROM: {package['version']}")
82+
83+
# Pre-release without --build-id: version is managed by the CI template
84+
# (standardizedVersioning). Just strip suffix if publishing.
85+
if not args.release and not args.build_id:
86+
if args.for_publishing and len(suffix):
87+
package["version"] = ".".join((major, minor, micro))
88+
print(f"Updating build TO: {package['version']}")
89+
package_json.write_text(
90+
json.dumps(package, indent=4, ensure_ascii=False) + "\n", encoding="utf-8"
91+
)
92+
return
93+
8294
if args.build_id:
8395
# If build id is provided it should fall within the 0-INT32 max range
8496
# that the max allowed value for publishing to the Marketplace.
@@ -88,9 +100,6 @@ def main(package_json: pathlib.Path, argv: Sequence[str]) -> None:
88100
package["version"] = ".".join((major, minor, str(args.build_id)))
89101
elif args.release:
90102
package["version"] = ".".join((major, minor, micro))
91-
else:
92-
# micro version only updated for pre-release.
93-
package["version"] = ".".join((major, minor, micro_build_number()))
94103

95104
if not args.for_publishing and not args.release and len(suffix):
96105
package["version"] += "-" + suffix

0 commit comments

Comments
 (0)