on: push: branches: [main] pull_request: jobs: build-and-deploy: runs-on: koda-k8s env: NAMESPACE: siwa-game-prd REGISTRY: siwa-game steps: - name: Checkout code uses: actions/checkout@v4 - name: Helm lint charts run: | helm lint charts - name: Docker login run: | docker login $REGISTRY_URL -u $REGISTRY_USER --password "$REGISTRY_PASS" - name: Build and push hugo run: | docker build --progress=plain -t $REGISTRY_URL/$REGISTRY/clem-hugo:${{ github.sha }} . docker push $REGISTRY_URL/$REGISTRY/clem-hugo:${{ github.sha }} - name: Ensure namespace exists run: | kubectl get ns $NAMESPACE || kubectl create namespace $NAMESPACE - name: Delete existing imagePullSecret (if exists) run: | kubectl delete secret registry-creds -n $NAMESPACE --ignore-not-found - name: Copy imagePullSecret to namespace run: | kubectl get secret registry-creds -n servadmin -o yaml \ | sed "s/namespace: servadmin/namespace: $NAMESPACE/" \ | kubectl apply -f - - name: Deploy with Helm run: | helm upgrade --install hugo charts \ --namespace $NAMESPACE \ --set hugo.repository=$REGISTRY_URL/$REGISTRY/clem-hugo \ --set hugo.tag=${{ github.sha }} \ --set hugo.domain=preprod.siwa-game.fr