From 602378ac97fcc91f92ca70434c66f5fcc8e1516c Mon Sep 17 00:00:00 2001 From: Ivan Filipovic Date: Mon, 20 Apr 2026 20:25:13 +0200 Subject: [PATCH] ci: add CI/CD workflow --- .gitea/workflows/ci.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c4b342c..e90ba46 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -10,12 +10,10 @@ env: IMAGE: git.fpmoz.sum.ba/${{ github.repository }} jobs: - # ── JOB 1: Build i Push Docker image ────────────────── build: - runs-on: self-hosted + runs-on: ubuntu-latest steps: - - name: Checkout koda uses: actions/checkout@v4 @@ -23,7 +21,7 @@ jobs: run: | echo ${{ secrets.REGISTRY_PASS }} | \ docker login $REGISTRY \ - -u ${{ secrets.REGISTRY_USER }} --stdin + -u ${{ secrets.REGISTRY_USER }} --password-stdin - name: Build i Push image run: | @@ -34,24 +32,30 @@ jobs: echo $TAG > tag.txt - name: Spremi image tag - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: image-tag path: tag.txt + # ── JOB 2: Deploy na k3s ─────────────────────────────── deploy: needs: build - runs-on: self-hosted + runs-on: ubuntu-latest steps: - - name: Checkout koda uses: actions/checkout@v4 - name: Preuzmi image tag - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: image-tag + - name: Instaliraj kubectl + run: | + curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + mv kubectl /usr/local/bin/ + - name: Postavi kubeconfig run: | mkdir -p ~/.kube @@ -65,6 +69,7 @@ jobs: - name: Deploy na k3s run: | - kubectl apply -f k8s/ + kubectl create namespace student-${{ github.actor }} --dry-run=client -o yaml | kubectl apply -f - + kubectl apply -f k8s/ -n student-${{ github.actor }} kubectl rollout status deployment/hello-cicd \ -n student-${{ github.actor }} --timeout=120s