fix: updated logic to update versions with scripts for nightly#1165
Open
lucaseduoli wants to merge 1 commit intomainfrom
Open
fix: updated logic to update versions with scripts for nightly#1165lucaseduoli wants to merge 1 commit intomainfrom
lucaseduoli wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the nightly build pipeline to generate a PEP 440–compliant nightly version/tag based on what’s already published to PyPI, update pyproject.toml metadata for a nightly distribution, and publish artifacts from that tagged commit.
Changes:
- Introduces CI scripts to generate a new nightly tag from PyPI state and update
pyproject.tomlname/version for nightly builds. - Replaces the workflow’s
check-versionjob withcreate-nightly-tag, committing/tagging the updated metadata and pushing the nightly tag. - Updates downstream jobs to depend on the new tag-creation job and attempts to publish PyPI artifacts from the created tag.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/nightly-build.yml |
Adds create-nightly-tag and adjusts job dependencies/checkout logic for nightly tagging and publishing. |
scripts/ci/pypi_nightly_tag.py |
Generates a nightly version tag using the latest base version in pyproject.toml and the latest published openrag-nightly version on PyPI. |
scripts/ci/update_pyproject_combined.py |
Orchestrates updating both the project name and version for nightly builds. |
scripts/ci/update_pyproject_name.py |
Updates the name = "..."" field in pyproject.toml. |
scripts/ci/update_pyproject_version.py |
Updates the version = "..."" field in pyproject.toml. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
|
||
| # Update name and version for openrag | ||
| update_pyproject_name("pyproject.toml", "openrag-nightly") | ||
| update_pyproject_version("pyproject.toml", main_tag) |
| path = Path(file_path) | ||
| if not path.exists(): | ||
| print(f"File {file_path} not found") | ||
| return |
Comment on lines
+5
to
+23
| def update_version(new_version): | ||
| pyproject_path = Path("pyproject.toml") | ||
| with open(pyproject_path, "r") as f: | ||
| content = f.read() | ||
|
|
||
| # Update the version field | ||
| # Removes 'v' prefix if present from tag | ||
| clean_version = new_version.lstrip('v') | ||
| new_content = re.sub(r'^version = "[^"]+"', f'version = "{clean_version}"', content, flags=re.M) | ||
|
|
||
| with open(pyproject_path, "w") as f: | ||
| f.write(new_content) | ||
| print(f"Updated pyproject.toml version to {clean_version}") | ||
|
|
||
| if __name__ == "__main__": | ||
| if len(sys.argv) < 2: | ||
| print("Usage: python update_pyproject_version.py <new_version>") | ||
| sys.exit(1) | ||
| update_version(sys.argv[1]) |
Comment on lines
+10
to
+15
| def get_latest_published_version(is_nightly: bool) -> Version: | ||
| url = PYPI_OPENRAG_NIGHTLY_URL if is_nightly else PYPI_OPENRAG_URL | ||
| res = requests.get(url, timeout=10) | ||
| if res.status_code == 404: | ||
| return None | ||
| res.raise_for_status() |
| nightly_base_version = current_nightly_version.base_version if current_nightly_version else None | ||
|
|
||
| if latest_base_version == nightly_base_version: | ||
| dev_number = (current_nightly_version.dev or -1) if current_nightly_version else -1 |
Comment on lines
140
to
142
| manifest: | ||
| needs: [build, check-version] | ||
| needs: [build, create-nightly-tag] | ||
| runs-on: ubuntu-latest |
| sys.exit(1) | ||
|
|
||
| # Update name and version for openrag | ||
| update_pyproject_name("pyproject.toml", "openrag-nightly") |
| import sys | ||
| from pathlib import Path | ||
| from update_pyproject_name import update_pyproject_name | ||
| from update_pyproject_version import update_pyproject_version |
| # Removes 'v' prefix if present from tag | ||
| clean_version = new_version.lstrip('v') | ||
| new_content = re.sub(r'^version = "[^"]+"', f'version = "{clean_version}"', content, flags=re.M) | ||
|
|
Comment on lines
56
to
58
| build: | ||
| needs: check-version | ||
| needs: create-nightly-tag | ||
| strategy: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the nightly build workflow to automate versioning and tagging for nightly releases, and introduces several scripts to manage the project name and version in
pyproject.toml. The workflow now generates a unique nightly tag based on published versions, updates project metadata, and pushes the tag to the repository. These changes ensure consistent and compliant nightly builds and simplify the version management process.Nightly build workflow automation
check-versionjob with a newcreate-nightly-tagjob in.github/workflows/nightly-build.yml, which checks out the code, sets up Python, installs dependencies, generates a nightly tag using a script, updatespyproject.toml, commits, tags, and pushes the nightly tag.build,manifest, andpublish-pypi) to referencecreate-nightly-taginstead ofcheck-version, ensuring correct job sequencing. [1] [2]Version and tag management
publish-pypijob with logic to fetch and checkout the correct nightly tag, ensuring builds use the tagged version.scripts/ci/pypi_nightly_tag.pyto generate a new nightly tag based on the latest published nightly version, following PEP 440 conventions.Project metadata update scripts
scripts/ci/update_pyproject_combined.pyto update both the project name and version inpyproject.tomlfor nightly builds.scripts/ci/update_pyproject_name.pyandscripts/ci/update_pyproject_version.pyto separately update the project name and version fields inpyproject.toml. [1] [2]