Skip to content

v0.0.3-followup-deploy #37

v0.0.3-followup-deploy

v0.0.3-followup-deploy #37

name: Build Push and Deploy Docker Image
on:
release:
types: [published] # This triggers the workflow when a release is published
jobs:
build:
runs-on: self-hosted
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: shaunly/real_char:latest
- name: Install and configure kubectl
uses: azure/setup-kubectl@v1
with:
version: 'v1.20.0'
- name: Deploy to Kubernetes
if: ${{ contains(github.ref, 'deploy') }}
run: |
echo "${{ secrets.KUBECONFIG }}" | base64 --decode > ./kubeconfig.yaml
export KUBECONFIG=./kubeconfig.yaml
kubectl rollout restart deployment realchar-dev-deployment