Skip to content

Commit 8dbcbb0

Browse files
authored
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
1 parent 67d5694 commit 8dbcbb0

File tree

4 files changed

+65
-41
lines changed

4 files changed

+65
-41
lines changed

.github/workflows/nightly_build.yml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,30 @@ jobs:
4949
run: |
5050
echo "Cannot skip tests while push_to_registry is true."
5151
exit 1
52+
resolve-release-branch:
53+
runs-on: ubuntu-latest
54+
outputs:
55+
branch: ${{ steps.get_branch.outputs.branch }}
56+
steps:
57+
- name: Find latest release branch
58+
id: get_branch
59+
run: |
60+
git ls-remote --heads https://github.com/${{ github.repository }} 'refs/heads/release-*' \
61+
| awk '{print $2}' \
62+
| sed 's|refs/heads/||' \
63+
| sort -V \
64+
| tail -n 1 > branch.txt
5265
66+
BRANCH=$(cat branch.txt)
67+
if [ -z "$BRANCH" ]; then
68+
echo "No release-* branch found in ${{ github.repository }}"
69+
exit 1
70+
fi
71+
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
72+
echo "Using release branch: $BRANCH"
5373
create-nightly-tag:
5474
if: github.repository == 'langflow-ai/langflow'
75+
needs: [validate-inputs, resolve-release-branch]
5576
runs-on: ubuntu-latest
5677
defaults:
5778
run:
@@ -60,13 +81,14 @@ jobs:
6081
# Required to create tag
6182
contents: write
6283
outputs:
63-
main_tag: ${{ steps.generate_main_tag.outputs.main_tag }}
84+
release_tag: ${{ steps.generate_release_tag.outputs.release_tag }}
6485
base_tag: ${{ steps.set_base_tag.outputs.base_tag }}
6586
lfx_tag: ${{ steps.generate_lfx_tag.outputs.lfx_tag }}
6687
steps:
6788
- name: Checkout code
6889
uses: actions/checkout@v6
6990
with:
91+
ref: ${{ needs.resolve-release-branch.outputs.branch }}
7092
persist-credentials: true
7193
- name: "Setup Environment"
7294
uses: astral-sh/setup-uv@v6
@@ -79,20 +101,20 @@ jobs:
79101
run: uv sync
80102

81103
- name: Generate main nightly tag
82-
id: generate_main_tag
104+
id: generate_release_tag
83105
run: |
84106
# NOTE: This outputs the tag with the `v` prefix.
85-
MAIN_TAG="$(uv run ./scripts/ci/pypi_nightly_tag.py main)"
86-
echo "main_tag=$MAIN_TAG" >> $GITHUB_OUTPUT
87-
echo "main_tag=$MAIN_TAG"
107+
RELEASE_TAG="$(uv run ./scripts/ci/pypi_nightly_tag.py main)"
108+
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
109+
echo "release_tag=$RELEASE_TAG"
88110
89111
- name: Delete existing tag if it exists
90-
id: check_main_tag
112+
id: check_release_tag
91113
run: |
92114
git fetch --tags
93-
git tag -d ${{ steps.generate_main_tag.outputs.main_tag }} || true
94-
git push --delete origin ${{ steps.generate_main_tag.outputs.main_tag }} || true
95-
echo "main_tag_exists=false" >> $GITHUB_OUTPUT
115+
git tag -d ${{ steps.generate_release_tag.outputs.release_tag }} || true
116+
git push --delete origin ${{ steps.generate_release_tag.outputs.release_tag }} || true
117+
echo "release_tag_exists=false" >> $GITHUB_OUTPUT
96118
97119
- name: Generate base nightly tag
98120
id: generate_base_tag
@@ -118,13 +140,13 @@ jobs:
118140
git config --global user.email "bot-nightly-builds@langflow.org"
119141
git config --global user.name "Langflow Bot"
120142
121-
MAIN_TAG="${{ steps.generate_main_tag.outputs.main_tag }}"
143+
RELEASE_TAG="${{ steps.generate_release_tag.outputs.release_tag }}"
122144
BASE_TAG="${{ steps.generate_base_tag.outputs.base_tag }}"
123145
LFX_TAG="${{ steps.generate_lfx_tag.outputs.lfx_tag }}"
124146
echo "Updating LFX project version to $LFX_TAG"
125147
uv run ./scripts/ci/update_lfx_version.py $LFX_TAG
126-
echo "Updating base project version to $BASE_TAG and updating main project version to $MAIN_TAG"
127-
uv run --no-sync ./scripts/ci/update_pyproject_combined.py main $MAIN_TAG $BASE_TAG $LFX_TAG
148+
echo "Updating base project version to $BASE_TAG and updating main project version to $RELEASE_TAG"
149+
uv run --no-sync ./scripts/ci/update_pyproject_combined.py main $RELEASE_TAG $BASE_TAG $LFX_TAG
128150
129151
uv lock
130152
cd src/backend/base && uv lock && cd ../../..
@@ -133,14 +155,14 @@ jobs:
133155
git add pyproject.toml src/backend/base/pyproject.toml src/lfx/pyproject.toml uv.lock src/backend/base/uv.lock
134156
git commit -m "Update version and project name"
135157
136-
echo "Tagging main with $MAIN_TAG"
137-
if ! git tag -a $MAIN_TAG -m "Langflow nightly $MAIN_TAG"; then
158+
echo "Tagging main with $RELEASE_TAG"
159+
if ! git tag -a $RELEASE_TAG -m "Langflow nightly $RELEASE_TAG"; then
138160
echo "Tag creation failed. Exiting the workflow."
139161
exit 1
140162
fi
141163
142-
echo "Pushing main tag $MAIN_TAG"
143-
if ! git push origin $MAIN_TAG; then
164+
echo "Pushing main tag $RELEASE_TAG"
165+
if ! git push origin $RELEASE_TAG; then
144166
echo "Tag push failed. Check if the tag already exists. Exiting the workflow."
145167
exit 1
146168
fi
@@ -149,7 +171,8 @@ jobs:
149171
- name: Checkout main nightly tag
150172
uses: actions/checkout@v6
151173
with:
152-
ref: ${{ steps.generate_main_tag.outputs.main_tag }}
174+
ref: ${{ steps.generate_release_tag.outputs.release_tag }}
175+
persist-credentials: true
153176

154177
- name: Retrieve Base Tag
155178
id: retrieve_base_tag
@@ -217,14 +240,15 @@ jobs:
217240
release-nightly-build:
218241
if: github.repository == 'langflow-ai/langflow' && always() && needs.frontend-tests.result != 'failure' && needs.backend-unit-tests.result != 'failure'
219242
name: Run Nightly Langflow Build
220-
needs: [create-nightly-tag, frontend-tests, backend-unit-tests]
243+
needs:
244+
[validate-inputs, create-nightly-tag, frontend-tests, backend-unit-tests]
221245
uses: ./.github/workflows/release_nightly.yml
222246
with:
223247
build_docker_base: true
224248
build_docker_main: true
225249
build_docker_ep: true
226250
build_lfx: true
227-
nightly_tag_main: ${{ needs.create-nightly-tag.outputs.main_tag }}
251+
nightly_tag_release: ${{ needs.create-nightly-tag.outputs.release_tag }}
228252
nightly_tag_base: ${{ needs.create-nightly-tag.outputs.base_tag }}
229253
nightly_tag_lfx: ${{ needs.create-nightly-tag.outputs.lfx_tag }}
230254
# When triggered by schedule, inputs.push_to_registry is not set, so default to true

.github/workflows/release_nightly.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ on:
2424
required: false
2525
type: boolean
2626
default: false
27-
nightly_tag_main:
27+
nightly_tag_release:
2828
description: "Tag for the nightly main build"
2929
required: true
3030
type: string
@@ -60,7 +60,7 @@ jobs:
6060
- name: Check out the code at a specific ref
6161
uses: actions/checkout@v6
6262
with:
63-
ref: ${{ inputs.nightly_tag_main }}
63+
ref: ${{ inputs.nightly_tag_release }}
6464
persist-credentials: true
6565
- name: "Setup Environment"
6666
uses: astral-sh/setup-uv@v6
@@ -126,7 +126,7 @@ jobs:
126126
- name: Check out the code at a specific ref
127127
uses: actions/checkout@v6
128128
with:
129-
ref: ${{ inputs.nightly_tag_main }}
129+
ref: ${{ inputs.nightly_tag_release }}
130130
persist-credentials: true
131131
- name: "Setup Environment"
132132
uses: astral-sh/setup-uv@v6
@@ -223,7 +223,7 @@ jobs:
223223
- name: Check out the code at a specific ref
224224
uses: actions/checkout@v6
225225
with:
226-
ref: ${{ inputs.nightly_tag_main}}
226+
ref: ${{ inputs.nightly_tag_release}}
227227
persist-credentials: true
228228
- name: "Setup Environment"
229229
uses: astral-sh/setup-uv@v6
@@ -269,8 +269,8 @@ jobs:
269269
echo "Name $name does not match langflow-nightly. Exiting the workflow."
270270
exit 1
271271
fi
272-
if [ "$version" != "${{ inputs.nightly_tag_main }}" ]; then
273-
echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_main }}. Exiting the workflow."
272+
if [ "$version" != "${{ inputs.nightly_tag_release }}" ]; then
273+
echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_release }}. Exiting the workflow."
274274
exit 1
275275
fi
276276
# Strip the leading `v` from the version
@@ -326,7 +326,7 @@ jobs:
326326
- name: Check out the code
327327
uses: actions/checkout@v6
328328
with:
329-
ref: ${{ inputs.nightly_tag_main }}
329+
ref: ${{ inputs.nightly_tag_release }}
330330
persist-credentials: true
331331
- name: Download LFX artifact
332332
uses: actions/download-artifact@v7
@@ -354,7 +354,7 @@ jobs:
354354
- name: Checkout code
355355
uses: actions/checkout@v6
356356
with:
357-
ref: ${{ inputs.nightly_tag_main }}
357+
ref: ${{ inputs.nightly_tag_release }}
358358
persist-credentials: true
359359
- name: Download base artifact
360360
uses: actions/download-artifact@v7
@@ -382,7 +382,7 @@ jobs:
382382
- name: Checkout code
383383
uses: actions/checkout@v6
384384
with:
385-
ref: ${{ inputs.nightly_tag_main }}
385+
ref: ${{ inputs.nightly_tag_release }}
386386
persist-credentials: true
387387
- name: Download main artifact
388388
uses: actions/download-artifact@v7
@@ -407,7 +407,7 @@ jobs:
407407
needs: [build-nightly-base, build-nightly-main]
408408
uses: ./.github/workflows/docker-nightly-build.yml
409409
with:
410-
ref: ${{ inputs.nightly_tag_main }}
410+
ref: ${{ inputs.nightly_tag_release }}
411411
release_type: nightly-base
412412
push_to_registry: ${{ inputs.push_to_registry }}
413413
secrets: inherit
@@ -418,7 +418,7 @@ jobs:
418418
needs: [build-nightly-main, call_docker_build_base]
419419
uses: ./.github/workflows/docker-nightly-build.yml
420420
with:
421-
ref: ${{ inputs.nightly_tag_main }}
421+
ref: ${{ inputs.nightly_tag_release }}
422422
release_type: nightly-main
423423
push_to_registry: ${{ inputs.push_to_registry }}
424424
secrets: inherit
@@ -430,9 +430,9 @@ jobs:
430430
# needs: [build-nightly-main]
431431
# uses: ./.github/workflows/docker-nightly-build.yml
432432
# with:
433-
# ref: ${{ inputs.nightly_tag_main }}
433+
# ref: ${{ inputs.nightly_tag_release }}
434434
# release_type: nightly-main-all
435-
# main_version: ${{ inputs.nightly_tag_main }}
435+
# main_version: ${{ inputs.nightly_tag_release }}
436436
# secrets: inherit
437437

438438
# call_docker_build_main_ep:
@@ -441,7 +441,7 @@ jobs:
441441
# needs: [build-nightly-main, call_docker_build_main]
442442
# uses: ./.github/workflows/docker-build-v2.yml
443443
# with:
444-
# ref: ${{ inputs.nightly_tag_main }}
444+
# ref: ${{ inputs.nightly_tag_release }}
445445
# release_type: main-ep
446446
# push_to_registry: ${{ inputs.push_to_registry }}
447447
# secrets: inherit

.secrets.baseline

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"filename": ".github/workflows/nightly_build.yml",
154154
"hashed_secret": "3e26d6750975d678acb8fa35a0f69237881576b0",
155155
"is_verified": false,
156-
"line_number": 322,
156+
"line_number": 257,
157157
"is_secret": false
158158
}
159159
],
@@ -5674,5 +5674,5 @@
56745674
}
56755675
]
56765676
},
5677-
"generated_at": "2026-03-12T02:41:29Z"
5678-
}
5677+
"generated_at": "2026-03-16T13:08:35Z"
5678+
}

scripts/ci/pypi_nightly_tag.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get_latest_published_version(build_type: str, *, is_nightly: bool) -> Versio
2727
raise ValueError(msg)
2828

2929
res = requests.get(url, timeout=10)
30+
res.raise_for_status()
3031
try:
3132
version_str = res.json()["info"]["version"]
3233
except Exception as e:
@@ -49,19 +50,18 @@ def create_tag(build_type: str):
4950

5051
try:
5152
current_nightly_version = get_latest_published_version(build_type, is_nightly=True)
52-
nightly_base_version = current_nightly_version.base_version
5353
except (requests.RequestException, KeyError, ValueError):
54-
# If MAIN_TAG nightly doesn't exist on PyPI yet, this is the first nightly
54+
# If nightly doesn't exist yet
5555
current_nightly_version = None
56-
nightly_base_version = None
5756

5857
build_number = "0"
5958
latest_base_version = current_version.base_version
60-
nightly_base_version = current_nightly_version.base_version
59+
nightly_base_version = current_nightly_version.base_version if current_nightly_version else None
6160

6261
if latest_base_version == nightly_base_version:
6362
# If the latest version is the same as the nightly version, increment the build number
64-
build_number = str(current_nightly_version.dev + 1)
63+
dev_number = (current_nightly_version.dev or 0) if current_nightly_version else 0
64+
build_number = str(dev_number + 1)
6565

6666
new_nightly_version = latest_base_version + ".dev" + build_number
6767

0 commit comments

Comments
 (0)