ci: add CI/CD workflow
Some checks failed
CI/CD Pipeline / build (push) Failing after 3s
CI/CD Pipeline / deploy (push) Failing after 26s

This commit is contained in:
Ivan Filipovic
2026-04-20 20:48:00 +02:00
parent 602378ac97
commit 2b569f38c5

View File

@@ -10,10 +10,12 @@ env:
IMAGE: git.fpmoz.sum.ba/${{ github.repository }}
jobs:
# ── JOB 1: Build i Push Docker image ──────────────────
build:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout koda
uses: actions/checkout@v4
@@ -21,7 +23,7 @@ jobs:
run: |
echo ${{ secrets.REGISTRY_PASS }} | \
docker login $REGISTRY \
-u ${{ secrets.REGISTRY_USER }} --password-stdin
-u ${{ secrets.REGISTRY_USER }} --stdin
- name: Build i Push image
run: |
@@ -32,30 +34,24 @@ jobs:
echo $TAG > tag.txt
- name: Spremi image tag
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: image-tag
path: tag.txt
# ── JOB 2: Deploy na k3s ───────────────────────────────
deploy:
needs: build
runs-on: ubuntu-latest
needs: buil
runs-on: self-hosted
steps:
- name: Checkout koda
uses: actions/checkout@v4
- name: Preuzmi image tag
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
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
@@ -69,7 +65,6 @@ jobs:
- name: Deploy na k3s
run: |
kubectl create namespace student-${{ github.actor }} --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f k8s/ -n student-${{ github.actor }}
kubectl apply -f k8s/
kubectl rollout status deployment/hello-cicd \
-n student-${{ github.actor }} --timeout=120s