This repository has been archived by the owner on Nov 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (73 loc) · 3.25 KB
/
cicd.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
77
78
79
80
81
82
name: CI/CD
on:
push:
branches:
- "master"
- "hotfix-*"
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to GHCR
run: echo ${{ secrets.CICD_ACTION_TOKEN }} | docker login ghcr.io -u ThomasK33 --password-stdin
- name: Set frontend build envs
run: echo -n ${{ secrets.FRONTEND_BUILD_DOTENV }} | base64 -d > services/frontend/.env
- name: Set Container Build Versions
run: |
echo BASE_VERSION=$(jq -r .version services/shared/package.json) >> $GITHUB_ENV
echo BACKEND_VERSION=$(jq -r .version services/backend/package.json) >> $GITHUB_ENV
echo FRONTEND_VERSION=$(jq -r .version services/frontend/package.json) >> $GITHUB_ENV
echo FSM_VERSION=$(jq -r .version services/fsm/package.json) >> $GITHUB_ENV
echo GSI_RECEIVER_VERSION=$(jq -r .version services/gsi-receiver/package.json) >> $GITHUB_ENV
echo TWITCHBOT_VERSION=$(jq -r .version services/17kmmrbot/package.json) >> $GITHUB_ENV
echo JOBS_VERSION=$(jq -r .version services/jobs/package.json) >> $GITHUB_ENV
echo HISTORIZATION_VERSION=$(jq -r .version services/historization/package.json) >> $GITHUB_ENV
echo SENTRY_DISCORD_WEBHOOK_VERSION=$(cat services/sentry-discord-webhook/version) >> $GITHUB_ENV
echo SENTRY_ORG='thomas-kosiewski' >> $GITHUB_ENV
echo SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} >> $GITHUB_ENV
- name: Pull all already existing images
# The exit code is always mapped to 0, as for some reason docker-compose pull likes to exit with a non-zero values
# even when --ignore-pull-failures is set
run: docker-compose -f build.docker-compose.yml pull --ignore-pull-failures || true
- name: Build base image
run: |
docker-compose -f build.docker-compose.yml up -d base
docker-compose -f build.docker-compose.yml down
- name: Build remaining images
run: |
docker-compose -f build.docker-compose.yml up -d
docker-compose -f build.docker-compose.yml down
- name: Push images to GHCR
run: docker-compose -f build.docker-compose.yml push
deploy:
needs: build
runs-on: ubuntu-20.04
defaults:
run:
working-directory: devops/kubernetes
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
- uses: azure/setup-kubectl@v1
with:
version: "v1.20.0"
- run: echo DOMAIN=fortify.gg >> $GITHUB_ENV
- run: mkdir -p ~/.kube/ && touch ~/.kube/config && echo ${{ secrets.KUBECONFIG }} | base64 --decode > ~/.kube/config
- run: touch .env && echo ${{ secrets.K8S_DOTENV }} | base64 --decode > .env
- run: npm ci
# - run: npm run record
# - run: npm run build
- run: npm run synth
- run: kubectl apply -f dist/fortify.k8s.yaml
- run: kubectl get deployment --output name -n fortify | xargs -n1 -t kubectl rollout status -n fortify --timeout=300s
- uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}