Skip to content

fix: updated logic to update versions with scripts for nightly#1165

Open
lucaseduoli wants to merge 1 commit intomainfrom
fix/nightly_tags
Open

fix: updated logic to update versions with scripts for nightly#1165
lucaseduoli wants to merge 1 commit intomainfrom
fix/nightly_tags

Conversation

@lucaseduoli
Copy link
Collaborator

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

  • Replaced the check-version job with a new create-nightly-tag job in .github/workflows/nightly-build.yml, which checks out the code, sets up Python, installs dependencies, generates a nightly tag using a script, updates pyproject.toml, commits, tags, and pushes the nightly tag.
  • Updated dependencies between jobs (build, manifest, and publish-pypi) to reference create-nightly-tag instead of check-version, ensuring correct job sequencing. [1] [2]

Version and tag management

  • Replaced manual version update logic in the publish-pypi job with logic to fetch and checkout the correct nightly tag, ensuring builds use the tagged version.
  • Added scripts/ci/pypi_nightly_tag.py to generate a new nightly tag based on the latest published nightly version, following PEP 440 conventions.

Project metadata update scripts

  • Added scripts/ci/update_pyproject_combined.py to update both the project name and version in pyproject.toml for nightly builds.
  • Added scripts/ci/update_pyproject_name.py and scripts/ci/update_pyproject_version.py to separately update the project name and version fields in pyproject.toml. [1] [2]

@lucaseduoli lucaseduoli self-assigned this Mar 17, 2026
@github-actions github-actions bot added ci ⬛ CI/CD, build, and infrastructure issues bug 🔴 Something isn't working. labels Mar 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.toml name/version for nightly builds.
  • Replaces the workflow’s check-version job with create-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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔴 Something isn't working. ci ⬛ CI/CD, build, and infrastructure issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants