From 189d8cf92e95d21ae42f44417b52f527933ad9b7 Mon Sep 17 00:00:00 2001 From: TheValll Date: Thu, 9 Jul 2026 20:53:01 +0200 Subject: [PATCH] Migration CI GitLab -> Gitea Actions --- .gitea/workflows/deploy.yaml | 44 +++++++++++++++++++++++++++++++++++ .gitlab-ci.yml => old_ci.yaml | 0 2 files changed, 44 insertions(+) create mode 100644 .gitea/workflows/deploy.yaml rename .gitlab-ci.yml => old_ci.yaml (100%) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..79c2122 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,44 @@ +name: build-and-deploy +on: + push: + branches: [main, master] + +env: + IMAGE: git.valentin-massonniere.ch/${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Login registry Gitea + run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.valentin-massonniere.ch -u "${{ secrets.REGISTRY_USER }}" --password-stdin + + - name: Build & push + run: | + docker build -t "$IMAGE:${{ github.sha }}" -t "$IMAGE:latest" . + docker push "$IMAGE:${{ github.sha }}" + docker push "$IMAGE:latest" + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Installer kubectl + run: | + curl -sLO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl && sudo mv kubectl /usr/local/bin/ + + - name: Configurer kubeconfig + run: | + mkdir -p ~/.kube + echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ~/.kube/config + chmod 600 ~/.kube/config + + - name: Déployer le Portfolio + run: | + kubectl apply -f k8s.yaml + kubectl rollout restart deployment/portfolio-app -n portfolio-ns diff --git a/.gitlab-ci.yml b/old_ci.yaml similarity index 100% rename from .gitlab-ci.yml rename to old_ci.yaml