-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (85 loc) · 2.41 KB
/
develop.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Develop
'on':
push:
branches:
- develop
workflow_dispatch:
env:
registry: europe-west9-docker.pkg.dev/healthy-saga-380423/demo-front
image: europe-west9-docker.pkg.dev/healthy-saga-380423/demo-front/develop
jobs:
Build:
name: build
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
outputs:
img: ${{ steps.meta.outputs.tags }}
steps:
- uses: 'actions/checkout@v3'
- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v0
with:
token_format: access_token
workload_identity_provider: ${{ secrets.WIF }}
service_account: ${{ secrets.WIF_SA }}
- name: Login to GCR
uses: docker/login-action@v2
with:
registry: ${{ env.registry }}
username: oauth2accesstoken
password: '${{ steps.auth.outputs.access_token }}'
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.image }}
tags: |
type=sha
- id: docker-push-tagged
name: Push Docker image to Google Artifact Registry
uses: docker/build-push-action@v3
with:
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
security:
runs-on: ubuntu-latest
#permissions: write-all
needs: [ build ]
steps:
- uses: 'actions/checkout@v3'
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --sarif-file-output=snyk.sarif
Deploy:
name: Deploy
needs: [ build, security ]
runs-on: ubuntu-latest
environment:
name: Develop
url: https://dev.demo.gcpdevops.fr
permissions:
contents: 'read'
id-token: 'write'
steps:
- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v0
with:
token_format: access_token
workload_identity_provider: ${{ secrets.WIF }}
service_account: ${{ secrets.WIF_SA }}
- id: deploy
uses: google-github-actions/deploy-cloudrun@v1
with:
service: demo-front
image: ${{needs.build.outputs.img}}
project_id: healthy-saga-380423
region: europe-west9