forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (91 loc) · 3.44 KB
/
Copy pathgcp_plugins.yml
File metadata and controls
106 lines (91 loc) · 3.44 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
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
name: Deploy Plugins to Cloud RUN
# TODO: determine if changes to backend folder before pushing
on:
workflow_dispatch:
inputs:
environment:
description: 'Select the environment to deploy to'
required: true
default: 'development'
type: choice
options:
- development
- prod
branch:
description: 'Branch to deploy from'
required: true
default: 'main'
release_version:
description: 'Release version (optional)'
required: false
default: ''
env:
SERVICE: plugins
REGION: us-central1
# Serialize writes to the selected Cloud Run service environment.
concurrency:
group: deploy-cloud-run-plugins-${{ github.event.inputs.environment }}
cancel-in-progress: false
jobs:
deploy:
environment: ${{ github.event.inputs.environment == 'prod' && 'prod' || 'development' }}
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: Validate Environment Input
env:
INPUT_ENV: ${{ github.event.inputs.environment }}
run: |
if [[ "$INPUT_ENV" != "development" && "$INPUT_ENV" != "prod" ]]; then
echo "Invalid environment: $INPUT_ENV. Must be 'development' or 'prod'."
exit 1
fi
# To workaround "no space left on device" issue of GitHub-hosted runner
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.inputs.branch }}
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v3'
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- run: gcloud auth configure-docker
- name: Build and Push Docker image
run: |
docker build -t gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }} -f plugins/Dockerfile .
python3 backend/scripts/runtime_image_contracts.py smoke \
--dockerfile plugins/Dockerfile \
--image gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}
docker push gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v3
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
image: gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}
# If required, use the Cloud Run url output in later steps
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}
- name: Generate deployment summary
if: always() && github.event.inputs.environment == 'prod'
uses: ./.github/actions/deployment-summary
with:
environment: ${{ github.event.inputs.environment }}
release_version: ${{ github.event.inputs.release_version }}
status: ${{ job.status }}
service: ${{ env.SERVICE }}
- name: Notify deployment status on Telegram
if: always() && github.event.inputs.environment == 'prod'
uses: ./.github/actions/deployment-notifier
with:
environment: ${{ github.event.inputs.environment }}
release_version: ${{ github.event.inputs.release_version }}
status: ${{ job.status }}
telegram_bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
telegram_chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}