-
-
Notifications
You must be signed in to change notification settings - Fork 28
76 lines (64 loc) · 2.75 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Deploy
on:
workflow_dispatch:
push:
branches:
- main
jobs:
Deploy:
name: Digital Ocean
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v2
- name: Build container image
run: docker build -t ianmitchell/aquarius:$(echo $GITHUB_SHA | head -c7) .
- name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- name: Push image to Docker Hub
run: docker push ianmitchell/aquarius:$(echo $GITHUB_SHA | head -c7)
- name: Update deployment file
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|ianmitchell/aquarius:'${TAG}'|' $GITHUB_WORKSPACE/kube/deployment.yml
- name: Save DigitalOcean kubeconfig
uses: digitalocean/action-doctl@master
env:
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
with:
args: kubernetes cluster kubeconfig show aquarius > $GITHUB_WORKSPACE/.kubeconfig
- name: Configure Kubernetes Secrets
env:
TOKEN: ${{ secrets.TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SENTRY: ${{ secrets.SENTRY }}
DICTIONARY_API_KEY: ${{ secrets.DICTIONARY_API_KEY }}
HEARTHSTONE_KEY: ${{ secrets.HEARTHSTONE_KEY }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}
DARK_SKY_API_KEY: ${{ secrets.DARK_SKY_API_KEY }}
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}
ALPHA_VANTAGE_KEY: ${{ secrets.ALPHA_VANTAGE_KEY }}
FINANCIAL_MODELING_API_KEY: ${{ secrets.FINANCIAL_MODELING_API_KEY }}
IQAIR_API_KEY: ${{ secrets.IQAIR_API_KEY }}
LOGDNA_KEY: ${{ secrets.LOGDNA_KEY }}
run: envsubst < $GITHUB_WORKSPACE/kube/_secrets.yml > $GITHUB_WORKSPACE/kube/secrets.yml
- name: Apply Database Migrations
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: npx prisma migrate deploy
- name: Deploy to DigitalOcean Kubernetes
uses: docker://lachlanevenson/k8s-kubectl
with:
args: --kubeconfig=/github/workspace/.kubeconfig apply -f /github/workspace/kube/deployment.yml -f /github/workspace/kube/secrets.yml
- name: Verify deployment
uses: docker://lachlanevenson/k8s-kubectl
with:
args: --kubeconfig=/github/workspace/.kubeconfig rollout status deployment/aquarius
- name: Discord Notification
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: Aquarius has been redeployed