-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (60 loc) · 2.03 KB
/
node.js.yml
File metadata and controls
65 lines (60 loc) · 2.03 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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Build and Deploy to Cloud Run
on:
push:
branches: [main]
paths-ignore:
- 'firestore.rules'
- 'tests/firestore/rules.spec.ts'
pull_request:
branches: [main]
paths-ignore:
- 'firestore.rules'
- 'tests/firestore/rules.spec.ts'
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
RUN_REGION: europe-west1
SERVICE_NAME: platform
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn
- run: 'yarn ci:format'
- run: 'yarn ci:lint'
- run: 'yarn ci:test'
- run: yarn build
- name: Setup Cypress
uses: cypress-io/github-action@v2
with:
command: 'yarn test:cy'
- name: Setup gcloud
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: google-github-actions/setup-gcloud@master
with:
version: '318.0.0'
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Build docker image using Cloud Build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |-
gcloud builds submit \
--quiet \
--tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |-
gcloud run deploy "$SERVICE_NAME" \
--quiet \
--region "$RUN_REGION" \
--max-instances 1 \
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
--platform "managed" \
--allow-unauthenticated