Skip to content

Commit 8279ecc

Browse files
simplify version fetching for both release workflows
1 parent aa876d0 commit 8279ecc

File tree

4 files changed

+84
-126
lines changed

4 files changed

+84
-126
lines changed

.github/workflows/docker-build-v2.yml

Lines changed: 16 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ run-name: Docker Build and Push @${{ inputs.release_type }} by @${{ github.actor
44
on:
55
workflow_call:
66
inputs:
7-
main_version:
8-
required: false
9-
type: string
10-
description: "Main version to tag images with. If not provided, will be extracted from pyproject.toml."
11-
base_version:
12-
required: false
13-
type: string
14-
description: "Base version to tag images with. If not provided, will be extracted from pyproject.toml."
157
release_type:
168
required: true
179
type: string
@@ -32,14 +24,6 @@ on:
3224

3325
workflow_dispatch:
3426
inputs:
35-
main_version:
36-
description: "Main version to tag images with. If not provided, will be extracted from pyproject.toml."
37-
required: false
38-
type: string
39-
base_version:
40-
description: "Base version to tag images with. If not provided, will be extracted from pyproject.toml."
41-
required: false
42-
type: string
4327
release_type:
4428
description: "Type of release. One of 'main', 'main-ep', 'base', 'main-all'."
4529
required: true
@@ -81,15 +65,10 @@ jobs:
8165
- name: Get version
8266
id: version
8367
run: |
84-
if [ -n "${{ inputs.base_version }}" ]; then
85-
echo "Using provided base version: ${{ inputs.base_version }}"
86-
echo version=${{ inputs.base_version }} >> $GITHUB_OUTPUT
87-
else
88-
echo "Extracting base version from pyproject.toml"
89-
version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//' | head -n 1)
90-
echo "Extracted base version: $version"
91-
echo version=$version >> $GITHUB_OUTPUT
92-
fi
68+
echo "Extracting base version from pyproject.toml"
69+
version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//' | head -n 1)
70+
echo "Using version: $version"
71+
echo version=$version >> $GITHUB_OUTPUT
9372
9473
- name: Set tags
9574
id: tags
@@ -150,15 +129,10 @@ jobs:
150129
- name: Get version
151130
id: version
152131
run: |
153-
if [ -n "${{ inputs.main_version }}" ]; then
154-
echo "Using provided main version: ${{ inputs.main_version }}"
155-
echo version=${{ inputs.main_version }} >> $GITHUB_OUTPUT
156-
else
157-
echo "Extracting main version from pyproject.toml"
158-
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
159-
echo "Extracted main version: $version"
160-
echo version=$version >> $GITHUB_OUTPUT
161-
fi
132+
echo "Extracting main version from pyproject.toml"
133+
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
134+
echo "Using version: $version"
135+
echo version=$version >> $GITHUB_OUTPUT
162136
163137
- name: Set tags
164138
id: tags
@@ -225,15 +199,10 @@ jobs:
225199
- name: Get version
226200
id: version
227201
run: |
228-
if [ -n "${{ inputs.main_version }}" ]; then
229-
echo "Using provided main version: ${{ inputs.main_version }}"
230-
echo version=${{ inputs.main_version }} >> $GITHUB_OUTPUT
231-
else
232-
echo "Extracting main version from pyproject.toml"
233-
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
234-
echo "Extracted main version: $version"
235-
echo version=$version >> $GITHUB_OUTPUT
236-
fi
202+
echo "Extracting main version from pyproject.toml"
203+
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
204+
echo "Using version: $version"
205+
echo version=$version >> $GITHUB_OUTPUT
237206
238207
- name: Set tags
239208
id: tags
@@ -295,15 +264,10 @@ jobs:
295264
- name: Get version
296265
id: version
297266
run: |
298-
if [ -n "${{ inputs.main_version }}" ]; then
299-
echo "Using provided main version: ${{ inputs.main_version }}"
300-
echo version=${{ inputs.main_version }} >> $GITHUB_OUTPUT
301-
else
302-
echo "Extracting main version from pyproject.toml"
303-
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
304-
echo "Extracted main version: $version"
305-
echo version=$version >> $GITHUB_OUTPUT
306-
fi
267+
echo "Extracting main version from pyproject.toml"
268+
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
269+
echo "Using version: $version"
270+
echo version=$version >> $GITHUB_OUTPUT
307271
308272
- name: Set tags
309273
id: tags

.github/workflows/docker-nightly-build.yml

Lines changed: 35 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ on:
1212
required: true
1313
type: string
1414
description: "Ref to check out (branch, tag, or commit). This is required -- it specifies where the source code for the release is located."
15-
main_version:
16-
required: false
17-
type: string
18-
description: "Override main version for tagging. If not provided, will be extracted from pyproject.toml."
19-
base_version:
20-
required: false
21-
type: string
22-
description: "Override base version for tagging. If not provided, will be extracted from pyproject.toml."
2315
push_to_registry:
2416
required: false
2517
type: boolean
@@ -39,15 +31,7 @@ on:
3931
ref:
4032
required: true
4133
type: string
42-
description: "Ref to check out (branch, tag, or commit). This is required -- it specifies where the source code for the release is located."
43-
main_version:
44-
description: "Override main version for tagging. If not provided, will be extracted from pyproject.toml."
45-
required: false
46-
type: string
47-
base_version:
48-
description: "Override base version for tagging. If not provided, will be extracted from pyproject.toml."
49-
required: false
50-
type: string
34+
description: "Ref to check out (branch, tag, or commit). This is required -- it specifies where the source code for the release is located. Note that if running via Github Actions, this tag (formatted as, e.g., v1.5.1.dev36) must be manually created and pushed to a branch prior to running the workflow."
5135
push_to_registry:
5236
description: "Whether to push images to registries. Set to false for testing builds without publishing."
5337
required: false
@@ -58,7 +42,6 @@ env:
5842
PYTHON_VERSION: "3.13"
5943

6044
jobs:
61-
# Nightly Base package builds
6245
build-nightly-base:
6346
name: Build Nightly Base Package
6447
if: ${{ inputs.release_type == 'nightly-base' }}
@@ -72,20 +55,19 @@ jobs:
7255
- name: Get version for tagging
7356
id: version
7457
run: |
75-
if [ -n "${{ inputs.base_version }}" ]; then
76-
echo "Using provided base version: ${{ inputs.base_version }}"
77-
echo version=${{ inputs.base_version }} >> $GITHUB_OUTPUT
78-
else
79-
echo "Extracting base version from code for nightly build"
80-
# For nightly, we might want to add a timestamp or commit hash
81-
base_version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//' | head -n 1)
82-
timestamp=$(date +%Y%m%d)
83-
commit_hash=$(git rev-parse --short HEAD)
84-
version="${base_version}-nightly-${timestamp}-${commit_hash}"
85-
echo "Generated nightly version: $version"
86-
echo version=$version >> $GITHUB_OUTPUT
58+
echo "Extracting base version from pyproject.toml"
59+
60+
# Use the exact version from pyproject.toml (must already be formatted correctly)
61+
version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//' | head -n 1)
62+
63+
# Verify nightly tag format
64+
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+$ ]]; then
65+
echo "Base version format is incorrect. Must be in the format (e.g.) v1.5.1.dev36"
66+
exit 1
8767
fi
8868
69+
echo "Using version: $version"
70+
echo version=$version >> $GITHUB_OUTPUT
8971
- name: Set nightly tags
9072
id: tags
9173
run: |
@@ -132,7 +114,6 @@ jobs:
132114
tags: ${{ steps.tags.outputs.ghcr_tags }}
133115
platforms: linux/amd64,linux/arm64
134116

135-
# Nightly Main package builds
136117
build-nightly-main:
137118
name: Build Nightly Main Package
138119
if: ${{ inputs.release_type == 'nightly-main' }}
@@ -146,19 +127,18 @@ jobs:
146127
- name: Get version for tagging
147128
id: version
148129
run: |
149-
if [ -n "${{ inputs.main_version }}" ]; then
150-
echo "Using provided main version: ${{ inputs.main_version }}"
151-
echo version=${{ inputs.main_version }} >> $GITHUB_OUTPUT
152-
else
153-
echo "Extracting main version from code for nightly build"
154-
# For nightly, we might want to add a timestamp or commit hash
155-
main_version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
156-
timestamp=$(date +%Y%m%d)
157-
commit_hash=$(git rev-parse --short HEAD)
158-
version="${main_version}-nightly-${timestamp}-${commit_hash}"
159-
echo "Generated nightly version: $version"
160-
echo version=$version >> $GITHUB_OUTPUT
130+
echo "Extracting main version from pyproject.toml"
131+
132+
# Use the exact version from pyproject.toml (must already be formatted correctly)
133+
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
134+
135+
# Verify nightly tag format
136+
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+$ ]]; then
137+
echo "Main version format is incorrect. Must be in the format (e.g.) v1.5.1.dev36"
138+
exit 1
161139
fi
140+
echo "Using version: $version"
141+
echo version=$version >> $GITHUB_OUTPUT
162142
163143
- name: Set nightly tags
164144
id: tags
@@ -206,7 +186,7 @@ jobs:
206186
tags: ${{ steps.tags.outputs.ghcr_tags }}
207187
platforms: linux/amd64,linux/arm64
208188

209-
# Nightly Main All package builds
189+
# nightly-main-all includes all the extras
210190
build-nightly-main-all:
211191
name: Build Nightly Main All Package
212192
if: ${{ inputs.release_type == 'nightly-main-all' }}
@@ -220,19 +200,18 @@ jobs:
220200
- name: Get version for tagging
221201
id: version
222202
run: |
223-
if [ -n "${{ inputs.main_version }}" ]; then
224-
echo "Using provided main version: ${{ inputs.main_version }}"
225-
echo version=${{ inputs.main_version }} >> $GITHUB_OUTPUT
226-
else
227-
echo "Extracting main version from code for nightly build"
228-
# For nightly, we might want to add a timestamp or commit hash
229-
main_version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
230-
timestamp=$(date +%Y%m%d)
231-
commit_hash=$(git rev-parse --short HEAD)
232-
version="${main_version}-nightly-${timestamp}-${commit_hash}"
233-
echo "Generated nightly version: $version"
234-
echo version=$version >> $GITHUB_OUTPUT
203+
echo "Extracting main version from pyproject.toml"
204+
205+
# Use the exact version from pyproject.toml (must already be formatted correctly)
206+
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
207+
208+
# Verify nightly tag format
209+
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+$ ]]; then
210+
echo "Main version format is incorrect. Must be in the format (e.g.) v1.5.1.dev36"
211+
exit 1
235212
fi
213+
echo "Using version: $version"
214+
echo version=$version >> $GITHUB_OUTPUT
236215
237216
- name: Set nightly all tags
238217
id: tags

.github/workflows/release.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ run-name: Langflow Release by @${{ github.actor }}
44
on:
55
workflow_dispatch:
66
inputs:
7+
release_branch:
8+
description: "Branch to release from. This is the branch that contains the source code for the release."
9+
required: true
10+
type: string
711
release_package_base:
812
description: "Release Langflow Base"
913
required: true
@@ -62,6 +66,7 @@ jobs:
6266
name: CI
6367
uses: ./.github/workflows/ci.yml
6468
with:
69+
branch: ${{ inputs.release_branch }}
6570
python-versions: "['3.10', '3.11', '3.12', '3.13']"
6671
frontend-tests-folder: "tests"
6772
release: true
@@ -80,6 +85,8 @@ jobs:
8085
steps:
8186
- name: Checkout code
8287
uses: actions/checkout@v5
88+
with:
89+
ref: ${{ inputs.release_branch }}
8390
- name: Setup Environment
8491
uses: astral-sh/setup-uv@v6
8592
with:
@@ -148,6 +155,8 @@ jobs:
148155
steps:
149156
- name: Checkout code
150157
uses: actions/checkout@v5
158+
with:
159+
ref: ${{ inputs.release_branch }}
151160
- name: Setup Environment
152161
uses: astral-sh/setup-uv@v6
153162
with:
@@ -301,9 +310,7 @@ jobs:
301310
needs: [publish-base, publish-main]
302311
uses: ./.github/workflows/docker-build-v2.yml
303312
with:
304-
ref: ${{ github.ref }}
305-
base_version: ${{ needs.publish-base.needs.build-base.outputs.version }}
306-
main_version: ${{ needs.publish-main.needs.build-main.outputs.version }}
313+
ref: ${{ inputs.release_branch }}
307314
release_type: base
308315
pre_release: ${{ inputs.pre_release }}
309316
secrets: inherit
@@ -314,8 +321,7 @@ jobs:
314321
needs: [publish-main, call_docker_build_base]
315322
uses: ./.github/workflows/docker-build-v2.yml
316323
with:
317-
ref: ${{ github.ref }}
318-
main_version: ${{ needs.publish-main.needs.build-main.outputs.version }}
324+
ref: ${{ inputs.release_branch }}
319325
release_type: main-ep
320326
pre_release: False
321327
secrets: inherit
@@ -326,8 +332,7 @@ jobs:
326332
needs: [publish-main, call_docker_build_main_ep]
327333
uses: ./.github/workflows/docker-build-v2.yml
328334
with:
329-
ref: ${{ github.ref }}
330-
main_version: ${{ needs.publish-main.needs.build-main.outputs.version }}
335+
ref: ${{ inputs.release_branch }}
331336
release_type: main
332337
pre_release: ${{ inputs.pre_release }}
333338
secrets: inherit
@@ -338,8 +343,7 @@ jobs:
338343
needs: [publish-main]
339344
uses: ./.github/workflows/docker-build-v2.yml
340345
with:
341-
ref: ${{ github.ref }}
342-
main_version: ${{ needs.publish-main.needs.build-main.outputs.version }}
346+
ref: ${{ inputs.release_branch }}
343347
release_type: main-all
344348
pre_release: ${{ inputs.pre_release }}
345349
secrets: inherit
@@ -355,6 +359,8 @@ jobs:
355359
steps:
356360
- name: Checkout code
357361
uses: actions/checkout@v5
362+
with:
363+
ref: ${{ inputs.release_branch }}
358364
- name: Setup Environment
359365
uses: astral-sh/setup-uv@v6
360366
with:
@@ -417,7 +423,7 @@ jobs:
417423
create_release:
418424
name: Create Release
419425
runs-on: ubuntu-latest
420-
needs: [publish-main, publish-lfx]
426+
needs: [build-main, build-lfx, publish-main, publish-lfx]
421427
if: always() && inputs.create_release == 'true' && (needs.publish-main.result == 'success' || needs.publish-lfx.result == 'success')
422428
steps:
423429
- uses: actions/download-artifact@v4
@@ -440,5 +446,5 @@ jobs:
440446
draft: false
441447
generateReleaseNotes: true
442448
prerelease: ${{ inputs.pre_release }}
443-
tag: ${{ needs.publish-main.needs.build-main.outputs.version || needs.publish-lfx.needs.build-lfx.outputs.version }}
444-
commit: ${{ github.ref }}
449+
tag: ${{ needs.build-main.outputs.version || needs.build-lfx.outputs.version }}
450+
commit: ${{ inputs.release_branch }}

0 commit comments

Comments
 (0)