-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (76 loc) · 3 KB
/
release.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
name: Release
on:
push:
branches: [main]
env:
GCP_PROJECT_ID: ${{secrets.GCP_PROJECT_ID}}
GCP_SERVICE_ACCOUNT: ${{secrets.GCP_SERVICE_ACCOUNT}}
GCP_IDENTITY_PROVIDER_ID: ${{secrets.GCP_IDENTITY_PROVIDER_ID}}
GCP_REGION: europe-west3
GCP_REPOSITORY: hydradx-api
GCP_APP: hydradx-api-app
GCP_JOBS: hydradx-api-jobs
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up npm
run: npm install
- name: Lint
run: npm run lint
build:
runs-on: ubuntu-latest
needs: test
permissions:
contents: "read"
id-token: "write"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Authenticate with GCP
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: ${{env.GCP_IDENTITY_PROVIDER_ID}}
service_account: ${{env.GCP_SERVICE_ACCOUNT}}
- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v1"
- name: Set up Docker
run: gcloud auth configure-docker ${{env.GCP_REGION}}-docker.pkg.dev
- name: Build and Push API app
run: |-
docker build --target api-app -t "${{env.GCP_REGION}}-docker.pkg.dev/${{env.GCP_PROJECT_ID}}/${{env.GCP_REPOSITORY}}/${{env.GCP_APP}}:latest" ./
docker push "${{env.GCP_REGION}}-docker.pkg.dev/${{env.GCP_PROJECT_ID}}/${{env.GCP_REPOSITORY}}/${{env.GCP_APP}}:latest"
- name: Build and Push API jobs
run: |-
docker build --target api-jobs -t "${{env.GCP_REGION}}-docker.pkg.dev/${{env.GCP_PROJECT_ID}}/${{env.GCP_REPOSITORY}}/${{env.GCP_JOBS}}:latest" ./
docker push "${{env.GCP_REGION}}-docker.pkg.dev/${{env.GCP_PROJECT_ID}}/${{env.GCP_REPOSITORY}}/${{env.GCP_JOBS}}:latest"
deploy:
runs-on: ubuntu-latest
needs: build
permissions:
contents: "read"
id-token: "write"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Authenticate with GCP
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: ${{env.GCP_IDENTITY_PROVIDER_ID}}
service_account: ${{env.GCP_SERVICE_ACCOUNT}}
- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v1"
- name: Set up gcloud beta
run: gcloud components install beta
- name: deploy cache_coingecko_tickers_job
run: gcloud beta run jobs replace .gcp/jobs/cache_coingecko_tickers_job.yml
- name: deploy cache_coinmarketcap_summary_job
run: gcloud beta run jobs replace .gcp/jobs/cache_coinmarketcap_summary_job.yml
- name: deploy cache_hydradx-ui_stats_tvl_job
run: gcloud beta run jobs replace .gcp/jobs/cache_hydradx-ui_stats_tvl_job.yml
- name: deploy cache_hydration-web_stats_job
run: gcloud beta run jobs replace .gcp/jobs/cache_hydration-web_stats_job.yml
- name: deploy api-app
run: gcloud beta run services replace .gcp/hydradx_api_app.yml