@@ -79,15 +79,25 @@ jobs:
79
79
token : ${{ secrets.PAT_GHOST }}
80
80
- name : Update lightning version
81
81
run : |
82
- import json, os
83
- fname = "versions.json"
84
- with open(fname, encoding="utf-8") as fopen:
82
+ import json, os, re
83
+ tag = os.getenv('TAG')
84
+ fname_json = "versions.json"
85
+ with open(fname_json, encoding="utf-8") as fopen:
85
86
vers = json.load(fopen)
86
- vers["lightning_version"] = os.getenv('TAG')
87
- with open(fname, "w", encoding="utf-8") as fopen:
87
+ vers["lightning_version"] = tag
88
+ conda_ = vers["conda_snapshot"].split(".")
89
+ conda_[-1] = str(int(conda_[-1]) + 1)
90
+ vers["conda_snapshot"] = ".".join(conda_)
91
+ with open(fname_json, "w", encoding="utf-8") as fopen:
88
92
json.dump(vers, fopen, indent=2)
89
93
# satisfy pre-commit with line fixer
90
94
fopen.write(os.linesep)
95
+ fname_txt = "conda-user/user-env-requirements.txt"
96
+ with open(fname_txt, encoding="utf-8") as fopen:
97
+ reqs = fopen.read()
98
+ reqs = re.sub(r"lightning\w*==([\d\.]+)", f"lightning=={tag}", reqs)
99
+ with open(fname_txt, "w", encoding="utf-8") as fopen:
100
+ fopen.write(reqs)
91
101
shell : python
92
102
- run : cat versions.json
93
103
99
109
committer :
GitHub <[email protected] >
100
110
author : ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
101
111
token : ${{ secrets.PAT_GHOST }}
102
- add-paths : versions.json
112
+ add-paths : |
113
+ versions.json
114
+ conda-user/user-env-requirements.txt
103
115
commit-message : " bumping lightning version -> (${{ env.TAG }})"
104
116
branch : " bump/lightning-${{ env.TAG }}"
105
117
# Delete the branch when closing pull requests, and when undeleted after merging.
0 commit comments