-
Notifications
You must be signed in to change notification settings - Fork 9
156 lines (127 loc) · 4.56 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
name: 'Ligretto release'
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'apps/ligretto-**'
- 'packages/ligretto-shared/**'
- 'packages/auth-front/**'
- 'packages/ui/**'
- .github/workflows/ligretto-deploy.yml
- '.docker/Ligretto-**'
- '.deploy/ligretto.deploy.yml'
- '.env*'
env:
LIGRETTO_APP_VERSION: ${{ github.run_id }}
jobs:
ligretto-frontend-build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@main
- uses: ./.github/actions/prepare-nodejs
name: Prepare Node.js
- 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: 652468293877db2de8390fa3
CAS_STATIC_URL: https://cas.mems.fun/static
CAS_URL: https://cas.mems.fun/api
AMPLITUDE_TOKEN: f55f6d07422dfb26ca4dfbe59a54d609
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- 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-22.04
steps:
- name: Checkout
uses: actions/checkout@main
- 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:
push: true
tags: |
ghcr.io/memebattle/ligretto-gameplay-backend:${{ github.sha }}
ghcr.io/memebattle/ligretto-gameplay-backend:${{ env.LIGRETTO_APP_VERSION }}
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-22.04
steps:
- name: Checkout
uses: actions/checkout@main
- 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:
push: true
tags: |
ghcr.io/memebattle/ligretto-core-backend:${{ github.sha }}
ghcr.io/memebattle/ligretto-core-backend:${{ env.LIGRETTO_APP_VERSION }}
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-22.04
environment:
name: Ligretto-production
url: https://ligretto.app
steps:
- uses: actions/checkout@main
name: Checkout
- name: Download frontend dist
id: download_frontend_dist
uses: actions/[email protected]
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'
yc_folder_id: ${{ vars.YC_FOLDER_ID }}
sa_auth_key: ${{ secrets.YC_WORKER_KEY }}
docker_registry_login: ${{ secrets.GHCR_USER }}
docker_registry_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: 'ligretto.app'