Skip to content

Deploy to Kubernetes #7

Deploy to Kubernetes

Deploy to Kubernetes #7

Workflow file for this run

name: Deploy to Kubernetes
on:
workflow_run:
workflows: ["Build and Push Images"]
types: [completed]
branches: [main]
jobs:
deploy:
name: Deploy to Kubernetes
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Check for KUBECONFIG secret
id: check_secret
run: |
if [ -n "${{ secrets.KUBECONFIG_B64 }}" ]; then
echo "has_secret=true" >> $GITHUB_OUTPUT
else
echo "has_secret=false" >> $GITHUB_OUTPUT
fi
- name: Checkout code
if: steps.check_secret.outputs.has_secret == 'true'
uses: actions/checkout@v4
- name: Set up kubectl
if: steps.check_secret.outputs.has_secret == 'true'
uses: azure/setup-kubectl@v4
with:
version: "v1.31.0"
- name: Configure kubectl
if: steps.check_secret.outputs.has_secret == 'true'
env:
KUBECONFIG_B64: ${{ secrets.KUBECONFIG_B64 }}
run: |
echo "${KUBECONFIG_B64}" | base64 --decode > /tmp/kubeconfig
export KUBECONFIG=/tmp/kubeconfig
# ... (rest of your deployment commands)