-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathdeploy-action.yml
61 lines (51 loc) · 1.7 KB
/
deploy-action.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
name: Build and Deploy to Cloud Run
on:
workflow_dispatch:
inputs:
serviceName:
description: 'Cloud run service name'
required: true
env:
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
RUN_REGION: europe-west4
SERVICE_NAME: ${{ github.event.inputs.serviceName }}
jobs:
setup-build-deploy:
name: Setup, Build, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install deps
run: |
npm ci
- name: Build svelte
run: |
npm run build
ls -al public/build
# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@master
with:
version: '290.0.1'
service_account_key: ${{ secrets.RUN_SA_KEY }}
project_id: ${{ secrets.RUN_PROJECT }}
# Build and push image to Google Container Registry
- name: Build
run: |-
gcloud builds submit \
--quiet \
--tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
# Deploy image to Cloud Run
- name: Deploy
run: |-
gcloud run deploy "$SERVICE_NAME" \
--quiet \
--region "$RUN_REGION" \
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
--platform "managed" \
--allow-unauthenticated \
--update-env-vars "NODE_ENV=production,ELASTIC_CLOUD_ID=${{ secrets.ELASTIC_CLOUD_ID }},ELASTIC_API_KEY=${{ secrets.ELASTIC_API_KEY }},GITHUB_APP_ID=${{ secrets.GITHUB_APP_ID }},GITHUB_APP_SECRET=${{ secrets.GITHUB_APP_SECRET }},COOKIE_SECRET=${{ secrets.COOKIE_SECRET }},ALLOWED_USERS=${{ secrets.ALLOWED_USERS }}"