-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 2.1 KB
/
deploy-api.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
on:
push:
paths:
- 'api/*'
- '.github/workflows/deploy-api.yml'
branches:
- main
name: Build and deploy the Rappseq API
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
SERVICE: rappseq-api
REGION: asia-east1
CONTAINER_REGISTRY: asia.gcr.io
jobs:
deploy:
name: Deploy identification API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
with:
project_id: ${{ env.PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true # Set to true to authenticate the Cloud Run action
- name: Save service account authentication file
run: 'echo "$SSH_KEY" > $GOOGLE_APPLICATION_CREDENTIALS'
shell: bash
env:
SSH_KEY: ${{ secrets.GCP_SA_KEY}}
GOOGLE_APPLICATION_CREDENTIALS: "api/auth/rappseq-935a00e0eb39.json"
- name: Retrieve kmer classifier databases
run: |-
gsutil cp -r gs://rappseq-data-1/classifiers/GBS/210524.db api/data/classifiers/GBS/210524.db
gsutil cp -r gs://rappseq-data-1/classifiers/GBS/210524_sero.db api/data/classifiers/GBS/210524_sero.db
gsutil cp -r gs://rappseq-data-1/classifiers/GBS/210607.db api/data/classifiers/GBS/210607.db
- name: Authorize Docker push
run: gcloud auth configure-docker
- name: Build and push API container
run: |-
docker build -t ${{ env.CONTAINER_REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} api/
docker push ${{ env.CONTAINER_REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v0.5.0
with:
service: ${{ env.SERVICE }}
image: ${{ env.CONTAINER_REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}
region: ${{ env.REGION }}
flags: "--cpu=1 --memory=4Gi --concurrency=10 --timeout=60m"
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}