-
Notifications
You must be signed in to change notification settings - Fork 54
63 lines (58 loc) · 1.95 KB
/
cd-analytics.yml
File metadata and controls
63 lines (58 loc) · 1.95 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
name: Deploy Analytics
run-name: Deploy ${{ inputs.version || 'main' }} to Analytics ${{ inputs.environment || 'nonprod' }}
on:
push:
branches:
- "main"
paths:
- "analytics/**"
- "infra/analytics/**"
- "infra/modules/**"
# Release deployments are handled by cd-release.yml to enforce deployment order
# (API -> Frontend -> NOFOs -> Analytics)
workflow_dispatch:
inputs:
environment:
description: Environment to deploy to
required: true
default: "dev"
type: choice
options:
- dev
- staging
- training
- grantee1
- prod
version:
required: true
default: "main"
description: Tag or branch or SHA to deploy
jobs:
analytics-checks:
name: Run Analytics Checks
uses: ./.github/workflows/ci-analytics.yml
secrets: inherit
vulnerability-scans:
name: Vulnerability Scans
uses: ./.github/workflows/vulnerability-scans.yml
with:
app_name: analytics
fail_on_vulns: ${{ ! contains(fromJSON(inputs.environment != null && format('["{0}"]', inputs.environment) || github.ref_name == 'main' && '["staging"]' || '["dev"]'), 'staging') }}
deploy:
name: Deploy
needs: [analytics-checks, vulnerability-scans]
uses: ./.github/workflows/deploy.yml
strategy:
max-parallel: 1
fail-fast: false
matrix:
envs: ${{ fromJSON(inputs.environment != null && format('["{0}"]', inputs.environment) || github.ref_name == 'main' && '["staging"]' || '["dev"]') }}
with:
app_name: "analytics"
environment: ${{ matrix.envs }}
version: ${{ inputs.version || github.ref }}
send-slack-notification:
if: failure() && (github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main'))
needs: [analytics-checks, vulnerability-scans, deploy]
uses: ./.github/workflows/send-slack-notification.yml
secrets: inherit