Skip to content

Use the commit hash as tag to deploy the latest commit #2

Use the commit hash as tag to deploy the latest commit

Use the commit hash as tag to deploy the latest commit #2

name: Build Docker Image, Push to GHCR and Deploy to GKE
on:
push:
branches:
- main
- feat/deployment
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/developmentseed/llllm:latest
ghcr.io/developmentseed/llllm:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: Configure kubectl
run: |
gcloud components install gke-gcloud-auth-plugin
gcloud config set project ${{ secrets.PROJECT_ID }}
gcloud config set compute/zone us-central1-f
gcloud container clusters get-credentials ${{ secrets.CLUSTER_NAME }}
- name: 'Set up Helm'
uses: 'Azure/setup-helm@v1'
with:
version: 'v3.12.0'
- name: "Deploy Helm Chart"
run: |
helm upgrade --install project-llllm deployment/helm --create-namespace --namespace project-llllm \
--set secrets.openai_api_key=${{ secrets.OPENAI_API_KEY }} \
--set streamlit.image.tag=${{ github.sha }}
- name: Create contacts configmap
run: kubectl apply -f deployment/k8s/configmap.yaml --namespace project-llllm