From 3b5af9736baff494743fc86e17d9ec3072610004 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 22 Nov 2020 10:21:53 +0200 Subject: Create job for deploying to Kubernetes --- .github/workflows/forms-backend.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/forms-backend.yml b/.github/workflows/forms-backend.yml index 0d222b6..8da1e21 100644 --- a/.github/workflows/forms-backend.yml +++ b/.github/workflows/forms-backend.yml @@ -98,3 +98,34 @@ jobs: tags: | ghcr.io/python-discord/forms-backend:latest ghcr.io/python-discord/forms-backend:${{ steps.sha_tag.outputs.tag }} + + deploy: + name: Deployment + runs-on: ubuntu-latest + + needs: [build] + if: github.ref == 'refs/heads/main' + + steps: + - name: Create SHA Container Tag + id: sha_tag + run: | + tag=$(cut -c 1-7 <<< $GITHUB_SHA) + echo "::set-output name=tag::$tag" + + - name: Checkout repository + uses: actions/checkout@v2 + + - 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: + manifest: | + deployment.yaml + images: 'ghcr.io/python-discord/forms-backend:${{ steps.sha_tag.outputs.tag }}' + kubectl-version: 'latest' -- cgit v1.2.3