Skip to content

Project as database for create/retrain/finetune #670

Project as database for create/retrain/finetune

Project as database for create/retrain/finetune #670

name: Build and deploy to dev
on:
pull_request:
types: [opened, reopened, synchronize, labeled]
jobs:
# Looks for labels like "deploy-to-<env>" attached to a PR so we can deploy to those envs
get-deploy-labels:
runs-on: mdb-dev
outputs:
deploy-envs: ${{ steps.get-labels.outputs.deploy-envs }}
steps:
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- id: get-labels
uses: ./github-actions/get-deploy-labels
build:
# Build our docker images based on our bake file
runs-on: mdb-dev
needs: [get-deploy-labels]
if: needs.get-deploy-labels.outputs.deploy-envs != '[]'
steps:
- uses: actions/checkout@v4
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
# Build the bakefile and push
- uses: ./github-actions/docker-bake
build_cache:
# Build our docker images based on our bake file
# This job only pushes the layers to the cache repo
# It's done separately so other jobs can run without waiting for this one
runs-on: mdb-dev
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- uses: ./github-actions/docker-bake-cache
trigger_deploy:
# Trigger private repo to deploy to dev envs
runs-on: mdb-dev
needs: [build, get-deploy-labels]
strategy:
matrix:
deploy-env: ${{fromJson(needs.get-deploy-labels.outputs.deploy-envs)}}
environment:
name: dev
if: needs.get-deploy-labels.outputs.deploy-envs != '[]'
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: mindsdb
repo: INTERNAL-mindsdb-build-deploy-to-kubernetes
github_token: ${{ secrets.REPO_DISPATCH_PAT_TOKEN }}
workflow_file_name: deploy-dev.yml
ref: main
client_payload: '{"image-tag-prefix": "${{ env.CI_SHA }}", "deploy-env": "${{matrix.deploy-env}}"}'
run_tests:
name: Run Post-Deploy Tests
needs: [trigger_deploy]
uses: ./.github/workflows/test_on_deploy.yml
secrets: inherit