From 50474abd17b428293dddb42b926781b3ccbb0044 Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Sun, 1 Feb 2026 21:09:21 -0800 Subject: [PATCH] add k8s deployment --- .gitea/workflows/demo.yaml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index d8ad9d0..3b901f9 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -1,12 +1,19 @@ -name: Gitea Actions Demo +name: Build and Deploy run-name: ${{ github.actor }} is building and pushing 🚀 -on: [push] +on: + pull_request: + branches: + - master env: REGISTRY: git.chopark.home + IMAGE: ${{ gitea.repository }} + DEPLOYMENT_NAME: ${{ gitea.repository##*/ }}-deployment # optional generic name + CONTAINER_NAME: ${DEPLOYMENT_NAME} # optional generic container name + NAMESPACE: catalog # optional namespace for the deployment jobs: - Explore-Gitea-Actions: + build-and-push: runs-on: ubuntu-latest steps: - name: Check out repository code @@ -23,10 +30,25 @@ jobs: - name: Build and Push Docker Image run: | - docker build -t ${{ env.REGISTRY }}/${{ gitea.repository }}:latest . - docker push ${{ env.REGISTRY }}/${{ gitea.repository }}:latest + docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest . + docker push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest - name: List files in the repository run: ls ${{ github.workspace }} - run: echo "🍏 Build and Push status is ${{ job.status }}." + + deploy-to-k8s: + needs: build-and-push + runs-on: ubuntu-latest + steps: + - name: Set Kubeconfig + run: | + echo "${{ secrets.KUBE_CONFIG }}" > kubeconfig.yaml + - name: Update Deployment Image + run: | + # export KUBECONFIG=kubeconfig.yaml + kubectl set image \ + deployment/${{ env.DEPLOYMENT_NAME }} \ + ${{ env.CONTAINER_NAME }}=${{ env.REGISTRY }}/${{ env.IMAGE }}:latest \ + -n ${{ env.NAMESPACE }} \ No newline at end of file