From 02ad844a17df88ddc02862eb65023678a9135d48 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:58:43 +0100 Subject: [PATCH] ci: bump also conda requirements (#19203) * ci: bump also conda requirements * Apply suggestions from code review --------- Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com> --- .github/workflows/release-pkg.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-pkg.yml b/.github/workflows/release-pkg.yml index d2d60bbc29f66..06703954b72d6 100644 --- a/.github/workflows/release-pkg.yml +++ b/.github/workflows/release-pkg.yml @@ -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 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.