-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: bump also conda requirements (#19203)
* ci: bump also conda requirements * Apply suggestions from code review --------- Co-authored-by: Justus Schock <[email protected]>
- Loading branch information
Showing
1 changed file
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,15 +79,25 @@ jobs: | |
token: ${{ secrets.PAT_GHOST }} | ||
- name: Update lightning version | ||
run: | | ||
import json, os | ||
fname = "versions.json" | ||
with open(fname, encoding="utf-8") as fopen: | ||
import json, os, re | ||
tag = os.getenv('TAG') | ||
fname_json = "versions.json" | ||
with open(fname_json, encoding="utf-8") as fopen: | ||
vers = json.load(fopen) | ||
vers["lightning_version"] = os.getenv('TAG') | ||
with open(fname, "w", encoding="utf-8") as fopen: | ||
vers["lightning_version"] = tag | ||
conda_ = vers["conda_snapshot"].split(".") | ||
conda_[-1] = str(int(conda_[-1]) + 1) | ||
vers["conda_snapshot"] = ".".join(conda_) | ||
with open(fname_json, "w", encoding="utf-8") as fopen: | ||
json.dump(vers, fopen, indent=2) | ||
# satisfy pre-commit with line fixer | ||
fopen.write(os.linesep) | ||
fname_txt = "conda-user/user-env-requirements.txt" | ||
with open(fname_txt, encoding="utf-8") as fopen: | ||
reqs = fopen.read() | ||
reqs = re.sub(r"lightning\w*==([\d\.]+)", f"lightning=={tag}", reqs) | ||
with open(fname_txt, "w", encoding="utf-8") as fopen: | ||
fopen.write(reqs) | ||
shell: python | ||
- run: cat versions.json | ||
|
||
|
@@ -99,7 +109,9 @@ jobs: | |
committer: GitHub <[email protected]> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
token: ${{ secrets.PAT_GHOST }} | ||
add-paths: versions.json | ||
add-paths: | | ||
versions.json | ||
conda-user/user-env-requirements.txt | ||
commit-message: "bumping lightning version -> (${{ env.TAG }})" | ||
branch: "bump/lightning-${{ env.TAG }}" | ||
# Delete the branch when closing pull requests, and when undeleted after merging. | ||
|