aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-11-14 22:44:41 +0000
committerGravatar Joe Banks <[email protected]>2020-11-14 22:44:41 +0000
commit00e7d79d6faa6b21d147bacd2d6452c9e3581992 (patch)
tree2383d1858707fdf1f78f57a8235349ec3bfa8db0
parentMerge pull request #515 from python-discord/feature/non-persistence (diff)
Add Kubernetes deployment stage to GitHub Actions
-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'