on: push: paths: - k8s/** - .forgejo/workflows/k8s-diff-and-deploy.yaml jobs: diff-and-deploy: runs-on: ubuntu-latest container: image: git.janky.solutions/jankysolutions/infra/deployer:latest steps: - uses: actions/checkout@v4 - name: kubectl diff and deploy run: | set -euo pipefail echo "${{ secrets.KUBERNETES_CLIENT_CONFIG }}" > ~/.kube/config for component in k8s/*; do if [ ! -d "${component}" ]; then continue fi touch "${component}/secrets.yaml" echo "👀 $ kubectl diff -k ${component}" kubectl diff -k "${component}" || echo if [[ "${GITHUB_REF_NAME}" == "main" ]]; then echo "🚀 $ kubectl apply -k ${component}" if [[ "${component}" == "k8s/operators" ]]; then kubectl apply -k "${component}" --server-side else kubectl apply -k "${component}" fi echo fi done