-
Notifications
You must be signed in to change notification settings - Fork 8
82 lines (74 loc) · 2.35 KB
/
deploy.yaml
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
name: Continuous delivery production
on:
push:
tags:
- "*.*.*"
env:
PROJECT_ID: obsidian-ai
SERVICE: embedbase-ava
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
# - name: Write .env from secrets.ENV_FILE & Load in environment
# run: |
# echo "${{ secrets.ENV_FILE }}" > .env
# set -a
# source .env
# set +a
# - name: Install Dependencies & test
# run: |
# make install
# make test
- id: auth
uses: google-github-actions/auth@v0
with:
credentials_json: "${{ secrets.GCP_SA_KEY_PROD }}"
- name: Authorize Docker push
run: gcloud auth configure-docker
- name: Get the version
id: get_version
run: echo "VERSION=$(sed -n 's/.*image:.*:\(.*\)/\1/p' service.prod.yaml)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: |
gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:latest
gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ env.VERSION }}
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v0
with:
metadata: service.prod.yaml
project_id: ${{ env.PROJECT_ID }}
region: us-central1
tag: ${{ env.VERSION }}
image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ env.VERSION }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
# - name: Deploy to Cloud Run dev
# uses: google-github-actions/deploy-cloudrun@v0
# with:
# metadata: service.dev.yaml
# project_id: ${{ env.PROJECT_ID }}
# region: us-central1
# tag: ${{ env.VERSION }}
# image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ env.VERSION }}