Skip to content

Merge pull request #31 from StreamPets/BE29-json-format-ssevents #10

Merge pull request #31 from StreamPets/BE29-json-format-ssevents

Merge pull request #31 from StreamPets/BE29-json-format-ssevents #10

Workflow file for this run

name: CI/CD Pipeline for StreamPets' Go back-end
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
run: |
docker build -t ljheal/streampets-backend:${{ github.sha }} .
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image to Docker Hub
uses: docker/build-push-action@v3
with:
push: true
tags: |
ljheal/streampets-backend:latest
ljheal/streampets-backend:${{ github.sha }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Kubeconfig
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
- name: Deploy to Kubernetes
run: |
kubectl apply -f .k8s/deployment.yaml
kubectl apply -f .k8s/service.yaml
kubectl apply -f .k8s/ingress.yaml
kubectl set image deployment/streampets-backend \
streampets-backend-container=docker.io/ljheal/streampets-backend:${{ github.sha }} \
-n streampets