-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pyproject.toml versions and add Docker Build and Push workflow (…
…#1985) * chore: Update pyproject.toml versions for langflow and langflow-base * feat(workflows): add Docker Build and Push workflow to automate building and pushing Docker images based on release type and version feat(workflows): add Pre-release workflow to automate releasing Langflow packages based on release type and version feat(workflows): create workflow to call Docker Build workflow and handle release creation based on release type
- Loading branch information
1 parent
ae44092
commit 9b2fe24
Showing
6 changed files
with
385 additions
and
231 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Docker Build and Push | ||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
release_type: | ||
required: true | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
release_type: | ||
required: true | ||
type: choice | ||
options: | ||
- base | ||
- main | ||
|
||
jobs: | ||
docker_build: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
file: | | ||
if [ "${{ inputs.release_type }}" == "base" ]; then | ||
./docker/build_and_push_base.Dockerfile | ||
else | ||
./docker/build_and_push.Dockerfile | ||
fi | ||
tags: | | ||
if [ "${{ inputs.release_type }}" == "base" ]; then | ||
langflowai/langflow:base-${{ inputs.version }} | ||
else | ||
langflowai/langflow:${{ inputs.version }} | ||
langflowai/langflow:1.0-alpha |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Langflow Pre-release | ||
run-name: Langflow Pre-release by @${{ github.actor }} | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_package: | ||
description: "Release package" | ||
required: true | ||
type: boolean | ||
default: false | ||
release_type: | ||
description: "Type of release (base or main)" | ||
required: true | ||
type: choice | ||
options: | ||
- base | ||
- main | ||
|
||
env: | ||
POETRY_VERSION: "1.8.2" | ||
|
||
jobs: | ||
release: | ||
name: Release Langflow | ||
if: inputs.release_package == true | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.check-version.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install poetry | ||
run: pipx install poetry==$POETRY_VERSION | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
cache: "poetry" | ||
- name: Check Version | ||
id: check-version | ||
run: | | ||
if [ "${{ inputs.release_type }}" == "base" ]; then | ||
version=$(cd src/backend/base && poetry version --short) | ||
last_released_version=$(curl -s "https://pypi.org/pypi/langflow-base/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1) | ||
else | ||
version=$(poetry version --short) | ||
last_released_version=$(curl -s "https://pypi.org/pypi/langflow/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1) | ||
fi | ||
if [ "$version" = "$last_released_version" ]; then | ||
echo "Version $version is already released. Skipping release." | ||
exit 1 | ||
else | ||
echo version=$version >> $GITHUB_OUTPUT | ||
fi | ||
- name: Build project for distribution | ||
run: | | ||
if [ "${{ inputs.release_type }}" == "base" ]; then | ||
make build base=true | ||
else | ||
make build main=true | ||
fi | ||
- name: Publish to PyPI | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
if [ "${{ inputs.release_type }}" == "base" ]; then | ||
make publish base=true | ||
else | ||
make publish main=true | ||
fi | ||
call_docker_build: | ||
name: Call Docker Build Workflow | ||
runs-on: ubuntu-latest | ||
needs: release | ||
steps: | ||
- uses: ./.github/workflows/docker-build.yml | ||
with: | ||
version: ${{ needs.release.outputs.version }} | ||
release_type: ${{ inputs.release_type }} | ||
|
||
create_release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
needs: [call_docker_build, release] | ||
if: ${{ inputs.release_type == 'main' }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "dist/*" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||
generateReleaseNotes: true | ||
prerelease: true | ||
tag: v${{ needs.release.outputs.version }} | ||
commit: dev |
Oops, something went wrong.