-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (67 loc) · 2.29 KB
/
Copy pathtesting_deploy.yml
File metadata and controls
79 lines (67 loc) · 2.29 KB
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
name: Testing Build and Deploy
# Controls when the action will run.
on:
push:
branches: [ "develop" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
BACKEND_IMAGE: cr.yandex/crp5q0eep54cgj8ppn6e/funnypuny-backend:${{ github.sha }}
NGINX_IMAGE: cr.yandex/crp5q0eep54cgj8ppn6e/funnypuny-nginx:${{ github.sha }}
jobs:
build-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Yandex Cloud Container Registry
id: login-cr
uses: yc-actions/yc-cr-login@v1
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
- name: Build, tag, and push image to Yandex Cloud Container Registry
run: |
docker build -t $BACKEND_IMAGE ./app
docker push $BACKEND_IMAGE
build-nginx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Yandex Cloud Container Registry
id: login-cr
uses: yc-actions/yc-cr-login@v1
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
- name: Build, tag, and push image to Yandex Cloud Container Registry
run: |
docker build -t $NGINX_IMAGE ./nginx
docker push $NGINX_IMAGE
deploy-testing-yc:
runs-on: ubuntu-latest
environment: testing
needs: [build-backend, build-nginx]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy COI VM
id: deploy-coi
uses: yc-actions/yc-coi-deploy@v1.0.1
env:
BACKEND_IMAGE: ${{ env.BACKEND_IMAGE }}
NGINX_IMAGE: ${{ env.NGINX_IMAGE }}
YC_VM_SSH: ${{ secrets.YC_VM_SSH }}
YC_VM_USERNAME: ${{ secrets.YC_VM_USERNAME }}
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
folder-id: ${{ secrets.YC_FOLDER_ID }}
VM-name: test-funnypuny-backend
vm-service-account-id: ${{ secrets.YC_SERVICE_ACCOUNT_ID }}
vm-cores: 2
vm-platform-id: 'standard-v2'
vm-memory: 2 GB
vm-disk-size: 30Gb
vm-core-fraction: 50
vm-subnet-id: ${{ secrets.YC_SUBNET_ID }}
docker-compose-path: './yandex-cloud/docker-compose.yaml'
user-data-path: './yandex-cloud/user-data.yaml'