Skip to content

Commit

Permalink
ci: bump also conda requirements (Lightning-AI#19203)
Browse files Browse the repository at this point in the history
* ci: bump also conda requirements
* Apply suggestions from code review

---------

Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
  • Loading branch information
Borda and justusschock authored Dec 21, 2023
1 parent 457ddd3 commit 02ad844
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/release-pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -99,7 +109,9 @@ jobs:
committer: GitHub <noreply@github.com>
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.
Expand Down

0 comments on commit 02ad844

Please sign in to comment.