-
Notifications
You must be signed in to change notification settings - Fork 36
80 lines (78 loc) · 2.79 KB
/
production.yaml
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
77
78
79
80
name: Production CI
on:
push:
branches:
- master
jobs:
lint_helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Lint Helm
run: helm lint ./charts/discord-bot
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: flybywiresim/discord-bot
tag-sha: true
tag-latest: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
cache-from: type=registry,ref=flybywiresim/discord-bot:master
cache-to: type=inline
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
deploy_production:
runs-on: ubuntu-latest
needs: [build_and_push, lint_helm]
env:
NAMESPACE: fbw-bot-prod
RELEASE_NAME: discord-bot
VALUES_FILE: ./charts/discord-bot/environments/production.yaml
BOT_SECRET: ${{ secrets.PROD_BOT_SECRET }}
METAR_TOKEN: ${{ secrets.METAR_TOKEN }}
STATION_TOKEN: ${{ secrets.STATION_TOKEN }}
WOLFRAMALPHA_TOKEN: ${{ secrets.WOLFRAMALPHA_TOKEN }}
MONGODB_URL: ${{ secrets.MONGODB_URL }}
BAN_APPEAL_URL: ${{ secrets.BAN_APPEAL_URL }}
IMAGE_BASE_URL: ${{ secrets.IMAGE_BASE_URL_PROD }}
TAF_TOKEN: ${{ secrets.TAF_TOKEN }}
steps:
- uses: actions/checkout@v1
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save ${{ secrets.DIGITALOCEAN_CLUSTER_ID }}
- name: Deploy
run: |
TAG=$(echo $GITHUB_SHA | head -c7) &&
helm upgrade --install --namespace ${NAMESPACE} \
--set image.tag=sha-${TAG} \
--set bot.secret=${BOT_SECRET} \
--set bot.metarToken=${METAR_TOKEN} \
--set bot.stationToken=${STATION_TOKEN} \
--set bot.wolframAlphaToken=${WOLFRAMALPHA_TOKEN} \
--set bot.mongodbUrl=${MONGODB_URL} \
--set bot.banAppealUrl=${BAN_APPEAL_URL} \
--set bot.imageBaseUrl=${IMAGE_BASE_URL} \
--set bot.tafToken=${TAF_TOKEN} \
-f ./charts/discord-bot/values.yaml -f ${VALUES_FILE} ${RELEASE_NAME} ./charts/discord-bot