Skip to content

Commit be5d6ed

Browse files
authored
Add date for nightly packages (microsoft#1668)
Add date for nightly packages, currently the package name is like this `0.9.0.dev0`, it will be replaced by `0.9.0.devYYYYMMDD` (eg. `0.9.0.dev20250731`).
1 parent d373cf9 commit be5d6ed

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.pipelines/stages/jobs/steps/utils/set-nightly-build-option-variable.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,22 @@ steps:
88
scriptSource: inline
99
script: |
1010
import os
11+
from pathlib import Path
12+
from datetime import datetime
1113
1214
name = "NightlyBuildOption"
1315
value = "--nightly_build" if os.environ.get("NIGHTLY_BUILD") == "1" else ""
1416
17+
# Add date to the version if it is a dev version
18+
file_path = Path("VERSION_INFO")
19+
with file_path.open("r", encoding="utf-8") as f:
20+
curr_version = f.readline().rstrip("\n")
21+
if curr_version.endswith("-dev"):
22+
today_yyyymmdd = datetime.now().strftime("%Y%m%d")
23+
curr_version += str(today_yyyymmdd)
24+
with open(file_path, "w", encoding="utf-8") as f:
25+
f.write(curr_version)
26+
1527
print("Setting variable: {} = '{}'".format(name, value))
1628
print("##vso[task.setvariable variable={}]{}".format(name, value))
1729
@@ -22,9 +34,21 @@ steps:
2234
scriptSource: inline
2335
script: |
2436
import os
37+
from pathlib import Path
38+
from datetime import datetime
2539
2640
name = "NightlyBuildOption"
2741
value = "--nightly_build" if os.environ.get("NIGHTLY_BUILD") == "1" else ""
2842
43+
# Add date to the version if it is a dev version
44+
file_path = Path("VERSION_INFO")
45+
with file_path.open("r", encoding="utf-8") as f:
46+
curr_version = f.readline().rstrip("\n")
47+
if curr_version.endswith("-dev"):
48+
today_yyyymmdd = datetime.now().strftime("%Y%m%d")
49+
curr_version += str(today_yyyymmdd)
50+
with open(file_path, "w", encoding="utf-8") as f:
51+
f.write(curr_version)
52+
2953
print("Setting variable: {} = '{}'".format(name, value))
3054
print("##vso[task.setvariable variable={}]{}".format(name, value))

0 commit comments

Comments
 (0)