From 8dbcbb0928e8ff48f2e04d6495abbe7d92d3429a Mon Sep 17 00:00:00 2001 From: Adam-Aghili <149833988+Adam-Aghili@users.noreply.github.com> Date: Mon, 16 Mar 2026 09:21:46 -0400 Subject: [PATCH] chore: release nightlies from of release branch (#12181) * chore: release nightlies from of release branch in preperation for the new release cycle strategy we will move the nightly to be run off the latest release branch. One caveat worth documenting: When we create the release branch we need to bump the verions for base and main immediately or else the ngihtly will run off the branch but will use a preveious release tag I also do not know how to deal with `merge-hash-history-to-main` in this case * chore: address valid code rabbit comments add clear error when branch does not exist make sure valid inputs is respected in the rest of the jobs/steps release_nightly.yml now uses nightly_tag_release instead of the old nightly_tag_main --- .github/workflows/nightly_build.yml | 62 +++++++++++++++++++-------- .github/workflows/release_nightly.yml | 28 ++++++------ .secrets.baseline | 6 +-- scripts/ci/pypi_nightly_tag.py | 10 ++--- 4 files changed, 65 insertions(+), 41 deletions(-) diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index adba3027b1..569f980901 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -49,9 +49,30 @@ jobs: run: | echo "Cannot skip tests while push_to_registry is true." exit 1 + resolve-release-branch: + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.get_branch.outputs.branch }} + steps: + - name: Find latest release branch + id: get_branch + run: | + git ls-remote --heads https://github.com/${{ github.repository }} 'refs/heads/release-*' \ + | awk '{print $2}' \ + | sed 's|refs/heads/||' \ + | sort -V \ + | tail -n 1 > branch.txt + BRANCH=$(cat branch.txt) + if [ -z "$BRANCH" ]; then + echo "No release-* branch found in ${{ github.repository }}" + exit 1 + fi + echo "branch=$BRANCH" >> $GITHUB_OUTPUT + echo "Using release branch: $BRANCH" create-nightly-tag: if: github.repository == 'langflow-ai/langflow' + needs: [validate-inputs, resolve-release-branch] runs-on: ubuntu-latest defaults: run: @@ -60,13 +81,14 @@ jobs: # Required to create tag contents: write outputs: - main_tag: ${{ steps.generate_main_tag.outputs.main_tag }} + release_tag: ${{ steps.generate_release_tag.outputs.release_tag }} base_tag: ${{ steps.set_base_tag.outputs.base_tag }} lfx_tag: ${{ steps.generate_lfx_tag.outputs.lfx_tag }} steps: - name: Checkout code uses: actions/checkout@v6 with: + ref: ${{ needs.resolve-release-branch.outputs.branch }} persist-credentials: true - name: "Setup Environment" uses: astral-sh/setup-uv@v6 @@ -79,20 +101,20 @@ jobs: run: uv sync - name: Generate main nightly tag - id: generate_main_tag + id: generate_release_tag run: | # NOTE: This outputs the tag with the `v` prefix. - MAIN_TAG="$(uv run ./scripts/ci/pypi_nightly_tag.py main)" - echo "main_tag=$MAIN_TAG" >> $GITHUB_OUTPUT - echo "main_tag=$MAIN_TAG" + RELEASE_TAG="$(uv run ./scripts/ci/pypi_nightly_tag.py main)" + echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT + echo "release_tag=$RELEASE_TAG" - name: Delete existing tag if it exists - id: check_main_tag + id: check_release_tag run: | git fetch --tags - git tag -d ${{ steps.generate_main_tag.outputs.main_tag }} || true - git push --delete origin ${{ steps.generate_main_tag.outputs.main_tag }} || true - echo "main_tag_exists=false" >> $GITHUB_OUTPUT + git tag -d ${{ steps.generate_release_tag.outputs.release_tag }} || true + git push --delete origin ${{ steps.generate_release_tag.outputs.release_tag }} || true + echo "release_tag_exists=false" >> $GITHUB_OUTPUT - name: Generate base nightly tag id: generate_base_tag @@ -118,13 +140,13 @@ jobs: git config --global user.email "bot-nightly-builds@langflow.org" git config --global user.name "Langflow Bot" - MAIN_TAG="${{ steps.generate_main_tag.outputs.main_tag }}" + RELEASE_TAG="${{ steps.generate_release_tag.outputs.release_tag }}" BASE_TAG="${{ steps.generate_base_tag.outputs.base_tag }}" LFX_TAG="${{ steps.generate_lfx_tag.outputs.lfx_tag }}" echo "Updating LFX project version to $LFX_TAG" uv run ./scripts/ci/update_lfx_version.py $LFX_TAG - echo "Updating base project version to $BASE_TAG and updating main project version to $MAIN_TAG" - uv run --no-sync ./scripts/ci/update_pyproject_combined.py main $MAIN_TAG $BASE_TAG $LFX_TAG + echo "Updating base project version to $BASE_TAG and updating main project version to $RELEASE_TAG" + uv run --no-sync ./scripts/ci/update_pyproject_combined.py main $RELEASE_TAG $BASE_TAG $LFX_TAG uv lock cd src/backend/base && uv lock && cd ../../.. @@ -133,14 +155,14 @@ jobs: git add pyproject.toml src/backend/base/pyproject.toml src/lfx/pyproject.toml uv.lock src/backend/base/uv.lock git commit -m "Update version and project name" - echo "Tagging main with $MAIN_TAG" - if ! git tag -a $MAIN_TAG -m "Langflow nightly $MAIN_TAG"; then + echo "Tagging main with $RELEASE_TAG" + if ! git tag -a $RELEASE_TAG -m "Langflow nightly $RELEASE_TAG"; then echo "Tag creation failed. Exiting the workflow." exit 1 fi - echo "Pushing main tag $MAIN_TAG" - if ! git push origin $MAIN_TAG; then + echo "Pushing main tag $RELEASE_TAG" + if ! git push origin $RELEASE_TAG; then echo "Tag push failed. Check if the tag already exists. Exiting the workflow." exit 1 fi @@ -149,7 +171,8 @@ jobs: - name: Checkout main nightly tag uses: actions/checkout@v6 with: - ref: ${{ steps.generate_main_tag.outputs.main_tag }} + ref: ${{ steps.generate_release_tag.outputs.release_tag }} + persist-credentials: true - name: Retrieve Base Tag id: retrieve_base_tag @@ -217,14 +240,15 @@ jobs: release-nightly-build: if: github.repository == 'langflow-ai/langflow' && always() && needs.frontend-tests.result != 'failure' && needs.backend-unit-tests.result != 'failure' name: Run Nightly Langflow Build - needs: [create-nightly-tag, frontend-tests, backend-unit-tests] + needs: + [validate-inputs, create-nightly-tag, frontend-tests, backend-unit-tests] uses: ./.github/workflows/release_nightly.yml with: build_docker_base: true build_docker_main: true build_docker_ep: true build_lfx: true - nightly_tag_main: ${{ needs.create-nightly-tag.outputs.main_tag }} + nightly_tag_release: ${{ needs.create-nightly-tag.outputs.release_tag }} nightly_tag_base: ${{ needs.create-nightly-tag.outputs.base_tag }} nightly_tag_lfx: ${{ needs.create-nightly-tag.outputs.lfx_tag }} # When triggered by schedule, inputs.push_to_registry is not set, so default to true diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.yml index 72ac8f93b3..43dfa3c460 100644 --- a/.github/workflows/release_nightly.yml +++ b/.github/workflows/release_nightly.yml @@ -24,7 +24,7 @@ on: required: false type: boolean default: false - nightly_tag_main: + nightly_tag_release: description: "Tag for the nightly main build" required: true type: string @@ -60,7 +60,7 @@ jobs: - name: Check out the code at a specific ref uses: actions/checkout@v6 with: - ref: ${{ inputs.nightly_tag_main }} + ref: ${{ inputs.nightly_tag_release }} persist-credentials: true - name: "Setup Environment" uses: astral-sh/setup-uv@v6 @@ -126,7 +126,7 @@ jobs: - name: Check out the code at a specific ref uses: actions/checkout@v6 with: - ref: ${{ inputs.nightly_tag_main }} + ref: ${{ inputs.nightly_tag_release }} persist-credentials: true - name: "Setup Environment" uses: astral-sh/setup-uv@v6 @@ -223,7 +223,7 @@ jobs: - name: Check out the code at a specific ref uses: actions/checkout@v6 with: - ref: ${{ inputs.nightly_tag_main}} + ref: ${{ inputs.nightly_tag_release}} persist-credentials: true - name: "Setup Environment" uses: astral-sh/setup-uv@v6 @@ -269,8 +269,8 @@ jobs: echo "Name $name does not match langflow-nightly. Exiting the workflow." exit 1 fi - if [ "$version" != "${{ inputs.nightly_tag_main }}" ]; then - echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_main }}. Exiting the workflow." + if [ "$version" != "${{ inputs.nightly_tag_release }}" ]; then + echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_release }}. Exiting the workflow." exit 1 fi # Strip the leading `v` from the version @@ -326,7 +326,7 @@ jobs: - name: Check out the code uses: actions/checkout@v6 with: - ref: ${{ inputs.nightly_tag_main }} + ref: ${{ inputs.nightly_tag_release }} persist-credentials: true - name: Download LFX artifact uses: actions/download-artifact@v7 @@ -354,7 +354,7 @@ jobs: - name: Checkout code uses: actions/checkout@v6 with: - ref: ${{ inputs.nightly_tag_main }} + ref: ${{ inputs.nightly_tag_release }} persist-credentials: true - name: Download base artifact uses: actions/download-artifact@v7 @@ -382,7 +382,7 @@ jobs: - name: Checkout code uses: actions/checkout@v6 with: - ref: ${{ inputs.nightly_tag_main }} + ref: ${{ inputs.nightly_tag_release }} persist-credentials: true - name: Download main artifact uses: actions/download-artifact@v7 @@ -407,7 +407,7 @@ jobs: needs: [build-nightly-base, build-nightly-main] uses: ./.github/workflows/docker-nightly-build.yml with: - ref: ${{ inputs.nightly_tag_main }} + ref: ${{ inputs.nightly_tag_release }} release_type: nightly-base push_to_registry: ${{ inputs.push_to_registry }} secrets: inherit @@ -418,7 +418,7 @@ jobs: needs: [build-nightly-main, call_docker_build_base] uses: ./.github/workflows/docker-nightly-build.yml with: - ref: ${{ inputs.nightly_tag_main }} + ref: ${{ inputs.nightly_tag_release }} release_type: nightly-main push_to_registry: ${{ inputs.push_to_registry }} secrets: inherit @@ -430,9 +430,9 @@ jobs: # needs: [build-nightly-main] # uses: ./.github/workflows/docker-nightly-build.yml # with: - # ref: ${{ inputs.nightly_tag_main }} + # ref: ${{ inputs.nightly_tag_release }} # release_type: nightly-main-all - # main_version: ${{ inputs.nightly_tag_main }} + # main_version: ${{ inputs.nightly_tag_release }} # secrets: inherit # call_docker_build_main_ep: @@ -441,7 +441,7 @@ jobs: # needs: [build-nightly-main, call_docker_build_main] # uses: ./.github/workflows/docker-build-v2.yml # with: - # ref: ${{ inputs.nightly_tag_main }} + # ref: ${{ inputs.nightly_tag_release }} # release_type: main-ep # push_to_registry: ${{ inputs.push_to_registry }} # secrets: inherit diff --git a/.secrets.baseline b/.secrets.baseline index 16a9457914..5fdc03d32d 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -153,7 +153,7 @@ "filename": ".github/workflows/nightly_build.yml", "hashed_secret": "3e26d6750975d678acb8fa35a0f69237881576b0", "is_verified": false, - "line_number": 322, + "line_number": 257, "is_secret": false } ], @@ -5674,5 +5674,5 @@ } ] }, - "generated_at": "2026-03-12T02:41:29Z" -} \ No newline at end of file + "generated_at": "2026-03-16T13:08:35Z" +} diff --git a/scripts/ci/pypi_nightly_tag.py b/scripts/ci/pypi_nightly_tag.py index 38d9c3450b..3bbc4bd9c6 100755 --- a/scripts/ci/pypi_nightly_tag.py +++ b/scripts/ci/pypi_nightly_tag.py @@ -27,6 +27,7 @@ def get_latest_published_version(build_type: str, *, is_nightly: bool) -> Versio raise ValueError(msg) res = requests.get(url, timeout=10) + res.raise_for_status() try: version_str = res.json()["info"]["version"] except Exception as e: @@ -49,19 +50,18 @@ def create_tag(build_type: str): try: current_nightly_version = get_latest_published_version(build_type, is_nightly=True) - nightly_base_version = current_nightly_version.base_version except (requests.RequestException, KeyError, ValueError): - # If MAIN_TAG nightly doesn't exist on PyPI yet, this is the first nightly + # If nightly doesn't exist yet current_nightly_version = None - nightly_base_version = None build_number = "0" latest_base_version = current_version.base_version - nightly_base_version = current_nightly_version.base_version + nightly_base_version = current_nightly_version.base_version if current_nightly_version else None if latest_base_version == nightly_base_version: # If the latest version is the same as the nightly version, increment the build number - build_number = str(current_nightly_version.dev + 1) + dev_number = (current_nightly_version.dev or 0) if current_nightly_version else 0 + build_number = str(dev_number + 1) new_nightly_version = latest_base_version + ".dev" + build_number