ci: enables docker builds for nightly tags (#3719)

This commit is contained in:
Jordan Frazier 2024-09-09 08:47:42 -07:00 committed by GitHub
commit 7f6b3873ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 59 additions and 20 deletions

View file

@ -12,10 +12,17 @@ on:
required: false
type: boolean
default: false
nightly_build:
nightly_tag_main:
description: "Tag for the nightly main build"
required: false
type: boolean
default: false
type: string
default: ''
nightly_tag_base:
description: "Tag for the nightly base build"
required: false
type: string
default: ''
workflow_dispatch:
inputs:
version:
@ -31,12 +38,17 @@ on:
required: false
type: boolean
default: false
nightly_build:
description: "Build nightly build"
nightly_tag_main:
description: "Tag for the nightly main build"
required: false
type: boolean
default: false
type: string
default: ''
nightly_tag_base:
description: "Tag for the nightly base build"
required: false
type: string
default: ''
env:
POETRY_VERSION: "1.8.2"
TEST_TAG: "langflowai/langflow:test"
@ -45,11 +57,25 @@ jobs:
get-version:
name: Get Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version-input.outputs.version || steps.get-version-base.outputs.version || steps.get-version-main.outputs.version }}
nightly-tag: ${{ steps.resolve-nightly-tag.outputs.nightly_tag }}
steps:
- uses: actions/checkout@v4
- name: Resolve nightly tag
id: resolve-nightly-tag
run: |
if [[ "${{ inputs.nightly_tag_main }}" != '' ]]; then
echo "nightly_tag=${{ inputs.nightly_tag_main }}" >> $GITHUB_OUTPUT
elif [[ "${{ inputs.nightly_tag_base }}" != '' ]]; then
echo "nightly_tag=${{ inputs.nightly_tag_base }}" >> $GITHUB_OUTPUT
else
echo "nightly_tag=" >> $GITHUB_OUTPUT
fi
- name: Check out the code at a specific ref (e.g., nightly tag)
uses: actions/checkout@v4
with:
ref: ${{ steps.resolve-nightly-tag.outputs.nightly_tag || github.ref }}
- name: Set up Python 3.12 + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
with:
@ -80,13 +106,19 @@ jobs:
outputs:
tags: ${{ steps.set-vars.outputs.tags }}
file: ${{ steps.set-vars.outputs.file }}
env:
NIGHTLY_TAG: ${{ needs.get-version.outputs.nightly-tag }}
steps:
- uses: actions/checkout@v4
- name: Check out the code at a specific ref (e.g., nightly tag)
uses: actions/checkout@v4
with:
ref: ${{ env.NIGHTLY_TAG || github.ref }}
- name: Set Dockerfile and Tags
id: set-vars
run: |
nightly_suffix=""
if [[ "${{ inputs.nightly_build }}" == "true" ]]; then
nightly_suffix=''
if [[ "${{ env.NIGHTLY_TAG }}" != '' ]]; then
nightly_suffix="-nightly"
fi
@ -103,9 +135,12 @@ jobs:
fi
build:
runs-on: ubuntu-latest
needs: setup
needs: [get-version, setup]
steps:
- uses: actions/checkout@v4
- name: Check out the code at a specific ref (e.g., nightly tag)
uses: actions/checkout@v4
with:
ref: ${{ needs.get-version.outputs.nightly-tag || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
@ -138,7 +173,11 @@ jobs:
dockerfile: ./docker/frontend/build_and_push_frontend.Dockerfile
tags: ${{ inputs.pre_release == 'true' && format('langflowai/langflow-frontend{0}:{1}', inputs.nightly_build && '-nightly' || '', needs.get-version.outputs.version) || format('langflowai/langflow-frontend{0}:{1},langflowai/langflow-frontend{0}:latest{1}', inputs.nightly_build && '-nightly' || '', needs.get-version.outputs.version) }}
steps:
- uses: actions/checkout@v4
- name: Check out the code at a specific ref (e.g., nightly tag)
uses: actions/checkout@v4
with:
ref: ${{ needs.get-version.outputs.nightly-tag || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub

View file

@ -104,8 +104,8 @@ jobs:
needs: [frontend-tests, backend-unit-tests, create-nightly-tag]
uses: ./.github/workflows/release_nightly.yml
with:
build_docker_base: false # TODO: Docker builds
build_docker_main: false
build_docker_base: true
build_docker_main: true
nightly_tag_main: ${{ needs.create-nightly-tag.outputs.main_tag }}
nightly_tag_base: ${{ needs.create-nightly-tag.outputs.base_tag }}
secrets: inherit

View file

@ -204,7 +204,7 @@ jobs:
# version should be needs.release-main.outputs.version if release_type is main
version: ""
release_type: ${{ matrix.release_type }}
nightly_build: true
nightly_tag_base: ${{ inputs.nightly_tag_base }}
secrets: inherit
call_docker_build_main:
@ -221,5 +221,5 @@ jobs:
# version should be needs.release-main.outputs.version if release_type is main
version: ""
release_type: ${{ matrix.release_type }}
nightly_build: true
nightly_tag_main: ${{ inputs.nightly_tag_main }}
secrets: inherit