Skip to content

Update deployment with new namespace #79

Update deployment with new namespace

Update deployment with new namespace #79

name: Docker
on:
push:
branches:
- main
jobs:
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Create SHA Container Tag
id: sha_tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "::set-output name=tag::$tag"
- 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.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=registry,ref=ghcr.io/python-discord/public-stats:latest
cache-to: type=inline
tags: |
ghcr.io/python-discord/public-stats:latest
ghcr.io/python-discord/public-stats:${{ steps.sha_tag.outputs.tag }}
- name: Authenticate with Kubernetes
uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG }}
- name: Deploy to Kubernetes
uses: Azure/k8s-deploy@v1
with:
manifests: |
deployment.yaml
images: 'ghcr.io/python-discord/public-stats:${{ steps.sha_tag.outputs.tag }}'
kubectl-version: 'latest'