@@ -13,80 +13,74 @@ permissions:
1313 id-token : write # Required for AWS OIDC authentication
1414
1515jobs :
16- generate-report :
16+ export-dashboards :
1717 runs-on : ubuntu-latest
1818 environment : reporting
19+ strategy :
20+ matrix :
21+ env_config :
22+ - name : Prod
23+ dashboard : Demand_And_Capacity_Prod
24+ account_secret : AWS_PROD_ACCOUNT_ID
25+ - name : Preprod
26+ dashboard : Demand_And_Capacity_Preprod
27+ account_secret : AWS_PREPROD_ACCOUNT_ID
28+ - name : Test
29+ dashboard : Demand_And_Capacity_Test
30+ account_secret : AWS_TEST_ACCOUNT_ID
31+ - name : Dev
32+ dashboard : Demand_And_Capacity_Dev
33+ account_secret : AWS_DEV_ACCOUNT_ID
1934
2035 steps :
2136 - name : Checkout code
22- uses : actions/checkout@v6
37+ uses : actions/checkout@v4
2338
2439 - name : Set up Python
25- uses : actions/setup-python@v6
40+ uses : actions/setup-python@v5
2641 with :
2742 python-version : " 3.11"
2843
29- # ----------------------------------------------------------------
30- # 1. Export PROD
31- # ----------------------------------------------------------------
32- - name : " Configure AWS Credentials (Prod)"
44+ - name : Configure AWS Credentials (${{ matrix.env_config.name }})
3345 uses : aws-actions/configure-aws-credentials@v5
3446 with :
35- role-to-assume : arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
47+ role-to-assume : arn:aws:iam::${{ secrets[matrix.env_config.account_secret] }}:role/service-roles/github-actions-api-deployment-role
3648 aws-region : eu-west-2
3749
38- - name : Export Dashboard (Prod )
50+ - name : Export Dashboard (${{ matrix.env_config.name }} )
3951 run : |
4052 chmod +x scripts/export_dashboard_image.sh
41- ./scripts/export_dashboard_image.sh Demand_And_Capacity_Prod Prod
53+ ./scripts/export_dashboard_image.sh ${{ matrix.env_config.dashboard }} ${{ matrix.env_config.name }}
4254 env :
4355 AWS_REGION : eu-west-2
4456
45- # ----------------------------------------------------------------
46- # 2. Export PREPROD
47- # ----------------------------------------------------------------
48- - name : " Configure AWS Credentials (Preprod)"
49- uses : aws-actions/configure-aws-credentials@v5
57+ - name : Upload dashboard export
58+ uses : actions/upload-artifact@v4
5059 with :
51- role-to-assume : arn:aws:iam::${{ secrets.AWS_PREPROD_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
52- aws-region : eu-west-2
53-
54- - name : Export Dashboard (Preprod)
55- run : ./scripts/export_dashboard_image.sh Demand_And_Capacity_Preprod Preprod
56- env :
57- AWS_REGION : eu-west-2
60+ name : dashboard-${{ matrix.env_config.name }}
61+ path : dashboard_exports/**/*
5862
59- # ----------------------------------------------------------------
60- # 3. Export TEST
61- # ----------------------------------------------------------------
62- - name : " Configure AWS Credentials (Test)"
63- uses : aws-actions/configure-aws-credentials@v5
64- with :
65- role-to-assume : arn:aws:iam::${{ secrets.AWS_TEST_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
66- aws-region : eu-west-2
63+ generate-report :
64+ runs-on : ubuntu-latest
65+ needs : export-dashboards
66+ environment : reporting
6767
68- - name : Export Dashboard (Test)
69- run : ./scripts/export_dashboard_image.sh Demand_And_Capacity_Test Test
70- env :
71- AWS_REGION : eu-west-2
68+ steps :
69+ - name : Checkout code
70+ uses : actions/checkout@v6
7271
73- # ----------------------------------------------------------------
74- # 4. Export DEV
75- # ----------------------------------------------------------------
76- - name : " Configure AWS Credentials (Dev)"
77- uses : aws-actions/configure-aws-credentials@v5
72+ - name : Set up Python
73+ uses : actions/setup-python@v6
7874 with :
79- role-to-assume : arn:aws:iam::${{ secrets.AWS_DEV_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
80- aws-region : eu-west-2
75+ python-version : " 3.11"
8176
82- - name : Export Dashboard (Dev)
83- run : ./scripts/export_dashboard_image.sh Demand_And_Capacity_Dev Dev
84- env :
85- AWS_REGION : eu-west-2
77+ - name : Download all dashboard exports
78+ uses : actions/download-artifact@v4
79+ with :
80+ path : dashboard_exports
81+ pattern : dashboard-*
82+ merge-multiple : true
8683
87- # ----------------------------------------------------------------
88- # Generate & Notify
89- # ----------------------------------------------------------------
9084 - name : Generate Combined Report
9185 run : python3 scripts/generate_dashboard_report.py --input dashboard_exports
9286
0 commit comments