Skip to content

Sync fork with main repo #1

Sync fork with main repo

Sync fork with main repo #1

name: Build and deploy to staging
on:
# Using pull_request instead of push on main because we want access to the pull request's details via 'github.event'
# But it means we need to check below if this PR was merged and not just closed
pull_request:
types:
- closed
# Cancel any existing runs of this workflow on the same branch/pr
# We always want to build/deploy/test a new commit over an older one
concurrency:
group: ${{ github.workflow_ref }}
cancel-in-progress: true
jobs:
# Build our docker images based on our bake file
build:
if: github.event.pull_request.merged == true
name: Build Docker Images
runs-on: mdb-dev
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 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
build_cache:
if: github.event.pull_request.merged == true
name: Build Docker Cache
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
# Call our deployment workflow
deploy:
name: Deploy to Staging
needs: [build]
uses: ./.github/workflows/deploy.yml
with:
deploy-envs: '["staging", "hackathon", "dev", "alpha-dev"]'
image-tag: ${{ github.sha }}
secrets: inherit
# Run integration tests
# TODO: Run these against the deployed environment
run_tests:
if: github.event.pull_request.merged == true
name: Run Integration Tests
needs: [deploy]
uses: ./.github/workflows/test_on_deploy.yml
secrets: inherit