-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (110 loc) · 3.88 KB
/
deploy.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
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
107
108
109
110
111
112
113
114
name: deploy
on:
workflow_dispatch:
jobs:
server:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
- name: Get Version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Login Docker
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- name: Build Server Image
if: steps.cache.outputs.cache-hit != 'true'
run: >-
DOCKER_BUILDKIT=1 docker build -f infra/docker/server.Dockerfile .
-t jimmypaolini/lexico-server:${{steps.package-version.outputs.current-version}}
-t jimmypaolini/lexico-server:latest
- name: Push Server Image
uses: actions-hub/docker@master
with:
args: push jimmypaolini/lexico-server
- name: Login Kubernetes
run: mkdir ~/.kube && echo "${{secrets.KUBE_CONFIG}}" > ~/.kube/config
- name: Deploy Server
run: kubectl rollout restart deployment server
database:
runs-on: ubuntu-latest
needs: server
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
- name: Download Postgres
run: sudo apt-get update && sudo apt-get install postgresql
- name: Install Dependencies
run: npm install && cd ingestion && npm install
- name: Setup Environment
run: echo "${{secrets.ENV_FILE}}" > .env
- name: Login Kubernetes
run: mkdir ~/.kube && echo "${{secrets.KUBE_CONFIG}}" > ~/.kube/config
- name: Database Port Forward
run: kubectl port-forward service/database 5432 &
- name: Deploy Database
run: cd ingestion && tsc && node --unhandled-rejections=strict dist/ingestion/src/restore.js ingested
web:
runs-on: ubuntu-latest
needs: database
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
- name: Get Version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Login Docker
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- name: Build Web Image
if: steps.cache.outputs.cache-hit != 'true'
run: >-
DOCKER_BUILDKIT=1 docker build -f infra/docker/web.Dockerfile .
-t jimmypaolini/lexico-web:${{steps.package-version.outputs.current-version}}
-t jimmypaolini/lexico-web:latest
- name: Push Web Image
uses: actions-hub/docker@master
with:
args: push jimmypaolini/lexico-web
- name: Login Kubernetes
run: mkdir ~/.kube && echo "${{secrets.KUBE_CONFIG}}" > ~/.kube/config
- name: Deploy Web
run: kubectl rollout restart deployment web
release:
runs-on: ubuntu-latest
needs: web
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
- name: Get Version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{steps.package-version.outputs.current-version}}
release_name: v${{steps.package-version.outputs.current-version}}
draft: true
prerelease: false
- name: Publish Release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{steps.create_release.outputs.id}}