forked from blockscout/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 20
97 lines (87 loc) · 2.99 KB
/
helm_deploy_call.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
86
87
88
89
90
91
92
93
94
95
96
97
---
name: 'Deploy a helm chart. Generic workflow'
on:
workflow_call:
inputs:
helmfile:
description: 'The helmfile to use for the deployment. It must be a local YAML file.'
required: true
type: string
action:
description: 'The helmfile action to use for the deployment.'
required: true
type: string
default: 'diff'
image-commit:
description: 'The image commit to use for the deployment.'
required: false
type: string
change-cause:
description: 'The change cause to use for the deployment.'
required: false
type: string
cluster-name:
required: true
type: string
project:
required: true
type: string
cluster-location:
required: true
type: string
service-account:
description: 'The service account name to use for the deployment. Project must be authorized to use this service account with Workload Identity Pool.'
required: true
type: string
env:
KUBE_CONFIG_PATH: /home/runner/.kube/config
USE_GKE_GCLOUD_AUTH_PLUGIN: "True"
jobs:
helmfile:
name: Auth, Setup + Run helmfile ${{ inputs.action }}
runs-on: ['self-hosted', 'org', 'helm']
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Export Environment Variables
uses: cardinalby/export-env-action@v2
with:
envFile: ./.github/workflows/.env
- id: 'auth-gcp-no-master'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ inputs.service-account }}
if: github.ref != 'refs/heads/master'
- id: 'auth-gcp-master'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER_MASTER }}
service_account: ${{ inputs.service-account }}
if: github.ref == 'refs/heads/master'
- name: 'Set up Cloud SDK'
if: ${{ inputs.run-gke-credentials }}
uses: 'google-github-actions/setup-gcloud@v1'
with:
install_components: 'core,gke-gcloud-auth-plugin,kubectl'
project_id: ${{ inputs.project }}
- name: 'Get GKE credentials'
uses: google-github-actions/get-gke-credentials@v1
with:
cluster_name: ${{ inputs.cluster-name }}
location: ${{ inputs.cluster-location }}
- name: Setup helmfile
uses: mamezou-tech/[email protected]
- name: Run helmfile
run: helmfile --color --file ${{ inputs.helmfile }} ${{ inputs.action }} --context 10
env:
CHANGE_CAUSE: ${{ inputs.change-cause }}
BLOCKSCOUT_IMAGE_TAG: ${{ inputs.image-commit }}