aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/lint-test-deploy.yaml (renamed from .github/workflows/lint-test-build.yaml)19
-rw-r--r--README.md2
-rw-r--r--deployment.yaml23
3 files changed, 41 insertions, 3 deletions
diff --git a/.github/workflows/lint-test-build.yaml b/.github/workflows/lint-test-deploy.yaml
index e8d4e9cc..754d2e49 100644
--- a/.github/workflows/lint-test-build.yaml
+++ b/.github/workflows/lint-test-deploy.yaml
@@ -1,4 +1,4 @@
-name: Lint & Test
+name: Lint, Test & Deploy
on:
push:
@@ -120,7 +120,8 @@ jobs:
run: docker-compose stop
if: ${{ always() }}
- build-and-push:
+ build-and-deploy:
+ name: Build and Deploy to Kubernetes
needs: lint-test
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
@@ -155,3 +156,17 @@ jobs:
tags: |
ghcr.io/python-discord/site:latest
ghcr.io/python-discord/site:${{ 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/site:${{ steps.sha_tag.outputs.tag }}'
+ kubectl-version: 'latest'
diff --git a/README.md b/README.md
index a1b72e73..b449d338 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Python Discord: Site
[![Discord](https://img.shields.io/static/v1?label=Python%20Discord&logo=discord&message=%3E100k%20members&color=%237289DA&logoColor=white)](https://discord.gg/2B963hn)
-![Lint & Test](https://github.com/python-discord/site/workflows/Lint%20&%20Test/badge.svg?branch=master)
+![Lint, Test & Deploy](https://github.com/python-discord/site/workflows/Lint,%20Test%20&%20Deploy/badge.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/python-discord/site/badge.svg?branch=master)](https://coveralls.io/github/python-discord/site?branch=master)
[![License](https://img.shields.io/github/license/python-discord/site)](LICENSE)
[![Status](https://img.shields.io/website?url=https%3A%2F%2Fpythondiscord.com)][1]
diff --git a/deployment.yaml b/deployment.yaml
new file mode 100644
index 00000000..b74e42d4
--- /dev/null
+++ b/deployment.yaml
@@ -0,0 +1,23 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: site
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: site
+ template:
+ metadata:
+ labels:
+ app: site
+ spec:
+ containers:
+ - name: site
+ image: ghcr.io/python-discord/site:latest
+ imagePullPolicy: Always
+ ports:
+ - containerPort: 8000
+ envFrom:
+ - secretRef:
+ name: site-env