-
Notifications
You must be signed in to change notification settings - Fork 9
171 lines (138 loc) · 4.73 KB
/
ligretto-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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: 'Ligretto build, push and deploy'
on:
push:
branches: [ master ]
paths-ignore:
- 'apps/gamehub-client/**'
- 'apps/blog/**'
- '.deploy'
- '!.deploy/ligretto.deploy.yml'
- '.docker'
- '!.docker/Ligretto*'
env:
AWS_REGION: 'eu-north-1'
jobs:
ligretto-frontend-build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version: '18.14'
cache: 'yarn'
- name: Install yarn
run: corepack enable
- name: Install dependencies
run: yarn
- name: Build frontend
run: yarn run ligretto:front:build
env:
LIGRETTO_GAMEPLAY_URL: https://api.ligretto.app
LIGRETTO_CORE_URL: https://core.ligretto.app/api
CAS_PARTNER_ID: 63b567bfd594b5085866649a
CAS_STATIC_URL: https://cas.mems.fun/static
CAS_URL: https://cas.mems.fun/api
AMPLITUDE_TOKEN: f55f6d07422dfb26ca4dfbe59a54d609
- name: Archive frontend production dist
uses: actions/upload-artifact@v3
with:
name: frontend-dist
path: |
apps/ligretto-frontend/dist
ligretto-gameplay-backend-image:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
push: true
tags: |
ghcr.io/memebattle/ligretto-gameplay-backend:${{ github.sha }}
ghcr.io/memebattle/ligretto-gameplay-backend:latest
context: '.'
file: '.docker/Ligretto-gameplay-backend_Dockerfile'
cache-from: type=gha,scope=$GITHUB_REF_NAME-ligretto-gameplay-backend
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-ligretto-gameplay-backend
ligretto-core-backend-image:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
push: true
tags: |
ghcr.io/memebattle/ligretto-core-backend:${{ github.sha }}
ghcr.io/memebattle/ligretto-core-backend:latest
context: '.'
file: '.docker/Ligretto-core-backend_Dockerfile'
cache-from: type=gha,scope=$GITHUB_REF_NAME-ligretto-core-backend
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-ligretto-core-backend
deploy:
needs: [ligretto-gameplay-backend-image, ligretto-core-backend-image, ligretto-frontend-build]
runs-on: ubuntu-20.04
environment:
name: Ligretto-production
url: https://ligretto.app
steps:
- uses: actions/checkout@v3
name: Checkout
- name: Download frontend dist
id: download_frontend_dist
uses: actions/download-artifact@v3
with:
name: frontend-dist
path: apps/ligretto-frontend/dist
- uses: ./.github/actions/deploy-to-swarm
name: Deploy to swarm lambda
with:
path-to-stack: '.deploy/ligretto.deploy.yml'
name: 'LIGRETTO'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
docker_login: ${{ secrets.GHCR_USER }}
docker_password: ${{ secrets.GHCR_PULL_TOKEN }}
docker_registry: 'ghcr.io'
- uses: ./.github/actions/deploy-to-s3
name: Deploy to s3
with:
path-to-folder: apps/ligretto-frontend/dist
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
bucket: 'lig-production-cdn-origin'
backup-bucket: 'lig-production-cdn-backup'