-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (64 loc) · 2.3 KB
/
Copy pathdeployment.yaml
File metadata and controls
71 lines (64 loc) · 2.3 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
name: Deploy Release
run-name: ${{ github.actor }} triggered deploy to ${{ github.event.inputs.env }} pipeline
on:
workflow_dispatch:
inputs:
env:
description: 'Select environment to deploy'
required: true
default: 'preprod'
type: choice
options:
- preprod
- prod
tag_version:
description: 'Tag version to be deployed'
required: true
default: ''
env:
PROJECT_ID: "${{ secrets.PROJECT_ID }}"
GAR_LOCATION: "${{ secrets.GAR_LOCATION }}"
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL}}"
SLACK_CHANNEL: "${{ secrets.GITHUBACTIONS_SLACK_CHANNEL }}"
jobs:
deploy:
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.env }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6
with:
ref: main
- name: Google Auth
id: auth
uses: "google-github-actions/auth@v2"
with:
token_format: "access_token"
project_id: "${{ secrets.PROJECT_ID }}"
workload_identity_provider: "${{ secrets.WIF_PROVIDER }}"
service_account: "${{ secrets.WIF_SERVICE_ACCOUNT }}"
- name: Deploy to Cloud Run
uses: actions-hub/gcloud@540.0.0
id: deploy
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
PROD_PROJECT_ID: ${{ secrets.PROD_PROJECT_ID }}
GAR_LOCATION: ${{ secrets.GAR_LOCATION }}
GAR_NAME: ${{ secrets.GAR_NAME }}
SERVICE_NAME: "${{ secrets.SERVICE_NAME }}"
SERVICE_REGION: "${{ secrets.SERVICE_REGION }}"
with:
args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROD_PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ github.event.inputs.tag_version }}:latest --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}'
- name: Run Notification
id: runnotificationsent
uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: ${{ env.SLACK_CHANNEL }}
message: Deploying tag ${{ github.event.inputs.tag_version }} to ENV ${{ github.event.inputs.env }} ${{ job.status }}
if: always()