-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (95 loc) · 2.73 KB
/
deployment.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: swis-api CI/CD pipeline
on:
workflow_dispatch:
push:
#branches: [ master ]
tags:
- 'v5.*'
jobs:
unit:
runs-on: [ self-hosted, builder, docker ]
steps:
- uses: actions/checkout@v4
- name: Run unit/integration tests.
env:
GIN_MODE: test
HOSTNAME: ${{ vars.HOSTNAME }}
run: make unit
build:
runs-on: [ self-hosted, builder, docker ]
needs: [ unit ]
steps:
- uses: actions/checkout@v4
- name: Build new swapi image (with staging).
env:
APP_URL: ${{ secrets.APP_URL }}
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }}
REGISTRY: ${{ secrets.REGISTRY }}
run: make build
push:
runs-on: [ self-hosted, builder, docker ]
needs: [ build ]
steps:
- uses: actions/checkout@v4
- name: Push the image to registry.
env:
REGISTRY: ${{ secrets.REGISTRY }}
run: make push_to_registry
test_deploy:
runs-on: [ self-hosted, rabbit, docker ]
needs: [ push ]
steps:
- uses: actions/checkout@v4
- name: Run test container and run end-to-end test on it.
env:
LOKI_URL: ${{ secrets.LOKI_URL }}
GIN_MODE: debug
HOSTNAME: ${{ vars.HOSTNAME }}
REGISTRY: ${{ secrets.REGISTRY }}
run: make test_deploy e2e
dump_data:
runs-on: [ self-hosted, rabbit, docker ]
needs: [ test_deploy ]
steps:
- uses: actions/checkout@v4
- name: Dump production data.
env:
APP_URL: ${{ secrets.APP_URL }}
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }}
run: make dump
prod_deploy:
runs-on: [ self-hosted, rabbit, docker ]
needs: [ dump_data ]
steps:
- uses: actions/checkout@v4
- name: Deploy prod docker container, recreate container with fresh image.
env:
APP_ENVIRONMENT: production
APP_URL: ${{ secrets.APP_URL }}
LOKI_URL: ${{ secrets.LOKI_URL }}
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }}
GIN_MODE: ${{ secrets.GIN_MODE }}
CF_BEARER_TOKEN: ${{ secrets.CF_BEARER_TOKEN }}
CF_API_EMAIL: ${{ secrets.CF_API_EMAIL }}
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
REGISTRY: ${{ secrets.REGISTRY }}
run: make run
import_data:
runs-on: [ self-hosted, rabbit, docker ]
needs: [ prod_deploy ]
steps:
- uses: actions/checkout@v4
- name: Import dumped data to production.
env:
APP_URL: ${{ secrets.APP_URL }}
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }}
run: make import_dump
generate_docs:
runs-on: [ self-hosted, rabbit, docker ]
needs: [ import_data ]
steps:
- uses: actions/checkout@v4
- name: (re)Generate interface API swagger docs.
env:
APP_URL: ${{ secrets.APP_URL }}
run: make docs