-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (56 loc) · 1.92 KB
/
gcrdeploy.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
name: Deploy
on:
push:
branches: [trunk]
paths:
- '**.ts'
- '**.yml'
- '**.yaml'
- 'Dockerfile'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
os: [linux]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci --no-optional --quiet
- run: npm run lint:fix
- run: npm run build
- run: npm test
deploy:
name: Setup Gcloud Account
runs-on: ubuntu-latest
needs:
- build
environment:
name: Production Release
url: https://view-counter.tobyhagan.com
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}
steps:
- name: Login
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_EMAIL }}
service_account_key: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Checkout repository
uses: actions/checkout@v2
- name: Build Docker image
run: docker build . -t $IMAGE_NAME
- name: Push Docker image
run: docker push $IMAGE_NAME
- name: Deploy Docker image
run: gcloud run deploy ${{ secrets.GCP_APP_NAME}} --image $IMAGE_NAME --region us-central1 --platform managed
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}