@@ -79,15 +79,25 @@ jobs:
7979          token : ${{ secrets.PAT_GHOST }} 
8080      - name : Update lightning version 
8181        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: 
8586              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: 
8892              json.dump(vers, fopen, indent=2) 
8993              # satisfy pre-commit with line fixer 
9094              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) 
91101shell : python 
92102      - run : cat versions.json 
93103
99109          committer : GitHub <noreply@github.com> 
100110          author : ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> 
101111          token : ${{ secrets.PAT_GHOST }} 
102-           add-paths : versions.json 
112+           add-paths : | 
113+             versions.json 
114+             conda-user/user-env-requirements.txt 
103115commit-message : " bumping lightning version -> (${{ env.TAG }})" 
104116          branch : " bump/lightning-${{ env.TAG }}" 
105117          #  Delete the branch when closing pull requests, and when undeleted after merging.
0 commit comments