add k8s deployment
Some checks failed
Build and Deploy / build-and-push (pull_request) Failing after 10s
Build and Deploy / deploy-to-k8s (pull_request) Has been skipped

This commit is contained in:
2026-02-01 21:09:21 -08:00
parent 154e9039c3
commit 50474abd17

View File

@@ -1,12 +1,19 @@
name: Gitea Actions Demo name: Build and Deploy
run-name: ${{ github.actor }} is building and pushing 🚀 run-name: ${{ github.actor }} is building and pushing 🚀
on: [push] on:
pull_request:
branches:
- master
env: env:
REGISTRY: git.chopark.home 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: jobs:
Explore-Gitea-Actions: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repository code - name: Check out repository code
@@ -23,10 +30,25 @@ jobs:
- name: Build and Push Docker Image - name: Build and Push Docker Image
run: | run: |
docker build -t ${{ env.REGISTRY }}/${{ gitea.repository }}:latest . docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest .
docker push ${{ env.REGISTRY }}/${{ gitea.repository }}:latest docker push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
- name: List files in the repository - name: List files in the repository
run: ls ${{ github.workspace }} run: ls ${{ github.workspace }}
- run: echo "🍏 Build and Push status is ${{ job.status }}." - 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 }}