Skip to content

Commit

Permalink
fix: add new ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-koontz committed Apr 22, 2024
1 parent 168bf5b commit c783737
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 104 deletions.
50 changes: 0 additions & 50 deletions .github/actions/build-push-ecr/action.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/actions/setup-env/action.yml

This file was deleted.

57 changes: 42 additions & 15 deletions .github/workflows/dev-build-deploy-on-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,67 @@ name: Dev - Build and Deploy on main
on:
push:
branches:
- master
- main

defaults:
run:
shell: bash

jobs:

build-hashnode-starter-kit:
runs-on: [self-hosted, dev]
jobs:
build:
runs-on: mdb-dev
env:
AWS_REGION: us-east-2
steps:
- uses: actions/checkout@v2
- name: Generate token
# Use the Github App private key to request an installation
# token with read-only access to the organization's private
# repositories. This token is then used in the checkout step
# (but not in subsequent steps that create releases and upload
# assets, those still use the default token that has write
# access to the current repository).
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.ACTION_APP_ID }}
private_key: ${{ secrets.ACTION_APP_KEY }}
- name: Checkout tag
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: ./.github/actions/setup-env
- uses: ./.github/actions/build-push-ecr
submodules: recursive
token: ${{ steps.generate_token.outputs.token }}
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
module-name: ${{ env.CI_REPOSITORY_NAME_SLUG }}
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- uses: ./github-actions/setup-env
- uses: ./github-actions/build-push-ecr
with:
module-name: ${{ env.CI_REPOSITORY_SLUG }}
build-for-environment: dev
# extra-build-args: "-f docker/mindsdb.Dockerfile"
extra-build-args: -f docker/Dockerfile

deploy:
runs-on: [self-hosted, dev]
needs: [build-hashnode-starter-kit]
runs-on: mdb-dev
needs: build
environment:
name: dev
url: https://hashnode.dev.mindsdb.com/blog
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup-env
- 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/setup-env
- uses: DevOps-Nirvana/aws-helm-multi-deploy-nodocker@v2
with:
environment-slug: dev
k8s-namespace: dev
image-tag: dev-${{ env.SLUG }}
image-tag: development-${{ env.SLUG }}
timeout: 600s
61 changes: 46 additions & 15 deletions .github/workflows/prod-build-deploy-on-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,69 @@ name: Prod - Build and Deploy on release
on:
release:
types: [published]
workflow_dispatch:

defaults:
run:
shell: bash


jobs:

build-hashnode-starter-kit:
runs-on: [self-hosted, dev]
build:
runs-on: mdb-dev
env:
AWS_REGION: us-east-2
steps:
- uses: actions/checkout@v2
- name: Generate token
# Use the Github App private key to request an installation
# token with read-only access to the organization's private
# repositories. This token is then used in the checkout step
# (but not in subsequent steps that create releases and upload
# assets, those still use the default token that has write
# access to the current repository).
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.ACTION_APP_ID }}
private_key: ${{ secrets.ACTION_APP_KEY }}
- name: Checkout tag
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: ./.github/actions/setup-env
- uses: ./.github/actions/build-push-ecr
submodules: recursive
token: ${{ steps.generate_token.outputs.token }}
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
module-name: ${{ env.CI_REPOSITORY_NAME_SLUG }}
build-for-environment: prod
# extra-build-args: "-f docker/mindsdb.Dockerfile"
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- uses: ./github-actions/setup-env
- uses: ./github-actions/build-push-ecr
with:
module-name: ${{ env.CI_REPOSITORY_SLUG }}
build-for-environment: production
extra-build-args: -f docker/Dockerfile
image-ref: ${{ env.CI_REF_SLUG }}

deploy:
runs-on: [self-hosted, prod]
needs: [build-hashnode-starter-kit]
deploy-prod:
runs-on: mdb-prod
needs: [build]
environment:
name: prod
url: https://mindsdb.com/blog
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup-env
- 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/setup-env
- uses: DevOps-Nirvana/aws-helm-multi-deploy-nodocker@v2
with:
environment-slug: prod
k8s-namespace: prod
image-tag: prod-${{ env.SLUG }}
image-tag: production-${{ env.CI_REF_SLUG }}
timeout: 600s

0 comments on commit c783737

Please sign in to comment.