Skip to content

Merge pull request #144 from kidata-summer-2023/noahpro99/issue141-cl… #12

Merge pull request #144 from kidata-summer-2023/noahpro99/issue141-cl…

Merge pull request #144 from kidata-summer-2023/noahpro99/issue141-cl… #12

Workflow file for this run

name: Deploy to Kubernetes
on:
push:
branches:
- main # or any branch you want to deploy from
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
# Steps will be defined here
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.prod
push: true
tags: ghcr.io/${{ github.repository_owner }}/codekids:${{ github.sha }}
- name: Set up Kubectl
uses: azure/setup-kubectl@v1
with:
version: 'latest'
- name: Update Kubernetes Deployment
run: |
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ./kubeconfig
export KUBECONFIG=./kubeconfig
kubectl set image deployment/codekids codekids=ghcr.io/${{ github.repository_owner }}/codekids:${{ github.sha }} --namespace codekids-app