diff options
-rw-r--r-- | .github/workflows/lint-build-deploy.yaml (renamed from .github/workflows/lint-build.yaml) | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/.github/workflows/lint-build.yaml b/.github/workflows/lint-build-deploy.yaml index 7001bc66..733328d4 100644 --- a/.github/workflows/lint-build.yaml +++ b/.github/workflows/lint-build-deploy.yaml @@ -1,4 +1,4 @@ -name: Linting & Building +name: Lint, Build & Deploy on: push: @@ -142,3 +142,34 @@ jobs: ghcr.io/python-discord/seasonalbot:${{ steps.sha_tag.outputs.tag }} pythondiscord/seasonalbot:latest pythondiscord/seasonalbot:${{ steps.sha_tag.outputs.tag }} + + deploy: + name: Deploy to the Kubernetes cluster + needs: build-and-push + if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + # Create a commit SHA-based tag for the container repositories + - name: Create SHA Container Tag + id: sha_tag + run: | + tag=$(cut -c 1-7 <<< $GITHUB_SHA) + echo "::set-output name=tag::$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/seasonalbot:${{ steps.sha_tag.outputs.tag }}' + kubectl-version: 'latest' |