Skip to content

Commit

Permalink
Merge pull request #40 from kotalco/prod-ci
Browse files Browse the repository at this point in the history
update/add prod ci jobs
  • Loading branch information
mFarghaly authored Apr 1, 2024
2 parents 769a882 + 274ce14 commit 83b9317
Showing 1 changed file with 26 additions and 72 deletions.
98 changes: 26 additions & 72 deletions .github/workflows/publish-cloud-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,91 +173,45 @@ jobs:
manifests: |
staging-managed-dashboard.yaml
# deploy_managed-dashboard_k8s-managed-production:
# runs-on: ubuntu-latest
# needs: [build]
# if: ${{ (github.event_name == 'push') && (github.ref == 'refs/heads/main') }}
# steps:
# - uses: actions/checkout@v3

# - name: Add SHORT_SHA env property with commit short sha
# run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV

# - name: Kustomize and validate k8s-manifests
# uses: yokawasa/action-setup-kube-tools@v0.9.2
# with:
# setup-tools: |
# kubeconform
# kustomize
# kubeconform: '0.5.0'
# kustomize: '4.5.7'
# - run: |
# kustomize build k8s-manifests/environments/production | kubeconform -verbose
# kustomize build k8s-manifests/environments/production > ./prod-managed-dashboard.yaml

# - name: update managed-dashboard with secrets values - production
# env:
# NEXT_PUBLIC_WS_API_URL: "${{ secrets.PROD_NEXT_PUBLIC_WS_API_URL }}"
# NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: "${{ secrets.PROD_NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY }}"
# API_URL: "${{ secrets.PROD_API_URL }}"
# run: |
# envsubst < ./prod-managed-dashboard.yaml | tee prod-managed-dashboard.yaml

# - name: K8s-set-context to DO managed-production cluster
# uses: azure/k8s-set-context@v1
# with:
# method: kubeconfig
# kubeconfig: ${{ secrets.KUBECONFIG_DO_MANAGED_PRODUCTION }}

# - name: Deploy to the DO managed-production cluster
# uses: azure/k8s-deploy@v1
# with:
# namespace: kotal
# manifests: |
# prod-managed-dashboard.yaml


update_dashboard_on-testing-k8s-clusters:
deploy_managed-dashboard_k8s-managed-production:
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push'

if: ${{ (github.event_name == 'push') && (github.ref == 'refs/heads/main') }}
steps:
- uses: actions/checkout@v3

- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV

- name: Get Latest core-api ImageTag
id: core-api_latest_tag
uses: luoqiz/docker-images-latest-version@master
with:
image: kotalco/core-api

- name: Checkout kotal-helm-chart Repo
uses: actions/checkout@v3
with:
repository: kotalco/kotal-helm-chart
path: kotal-helm-chart

- name: Set up Helm
uses: azure/setup-helm@v3
- name: Kustomize and validate k8s-manifests
uses: yokawasa/action-setup-kube-tools@v0.9.2
with:
version: v3.10.0
setup-tools: |
kubeconform
kustomize
kubeconform: '0.5.0'
kustomize: '4.5.7'
- run: |
kustomize build k8s-manifests/environments/production | kubeconform -verbose
kustomize build k8s-manifests/environments/production > ./prod-managed-dashboard.yaml
- name: Add helm dependencies repositories
- name: update managed-dashboard with secrets values - production
env:
NEXT_PUBLIC_WS_API_URL: "${{ secrets.PROD_NEXT_PUBLIC_WS_API_URL }}"
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: "${{ secrets.PROD_NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY }}"
API_URL: "${{ secrets.PROD_API_URL }}"
run: |
for dir in $(ls -d kotal-helm-chart/charts/*/); do
helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
done
helm dependency update kotal-helm-chart/charts/kotal
envsubst < ./prod-managed-dashboard.yaml | tee prod-managed-dashboard.yaml
- name: K8s-set-context to DO testing cluster
- name: K8s-set-context to DO managed-production cluster
uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG_DO_TESTING }}
kubeconfig: ${{ secrets.KUBECONFIG_DO_MANAGED_PRODUCTION }}

- name: Testing and Update Kotal-Helm-Chart in DO with kotal dashboard new image [kotal.cloud]
run: |
helm upgrade kotal kotal-helm-chart/charts/kotal --install --wait --namespace=kotal --create-namespace --set-string "api.tag=${{ steps.core-api_latest_tag.outputs.version }}" --set-string "dashboard.tag=${SHORT_SHA}" --set "staging=true" --set=app.name=kotal --reuse-values --atomic
- name: Deploy to the DO managed-production cluster
uses: azure/k8s-deploy@v1
with:
namespace: kotal
manifests: |
prod-managed-dashboard.yaml

0 comments on commit 83b9317

Please sign in to comment.