generated from pagopa/template-java-spring-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (167 loc) · 5.62 KB
/
09_create_dashboard.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#name: Create Dashboard
#
## Controls when the workflow will run
#on:
# push:
# branches:
# - main
# paths:
# - 'openapi/**'
# - '.github/workflows/09_create_dashboard.yaml'
# - '.opex/**'
#
# workflow_dispatch:
#
#permissions:
# id-token: write
# contents: read
# deployments: write#name: Create Dashboard
##
### Controls when the workflow will run
##on:
## push:
## branches:
## - main
## paths:
## - 'openapi/**'
## - '.github/workflows/09_create_dashboard.yaml'
## - '.opex/**'
##
## workflow_dispatch:
##
##permissions:
## id-token: write
## contents: read
## deployments: write
##
### A workflow run is made up of one or more jobs that can run sequentially or in parallel
##jobs:
## dashboard:
## # The type of runner that the job will run on
## runs-on: ubuntu-22.04
##
## strategy:
## matrix:
## environment: [prod]
## environment:
## name: ${{ matrix.environment }}
## # Steps represent a sequence of tasks that will be executed as part of the job
## steps:
## - name: Checkout
## id: checkout
## # from https://github.com/actions/checkout/commits/main
## uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707
## with:
## persist-credentials: false
##
## # from https://github.com/pagopa/opex-dashboard-azure-action/
## - uses: pagopa/[email protected]
## with:
## environment: ${{ matrix.environment }}
## api-name:
## config: .opex/env/${{ matrix.environment }}/config.yaml
## client-id: ${{ secrets.CLIENT_ID }}
## tenant-id: ${{ secrets.TENANT_ID }}
## subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
## # from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
## docker-version: sha256:e4245954566cd3470e1b5527d33bb58ca132ce7493eac01be9e808fd25a11c8d
##
## delete_github_deployments:
## runs-on: ubuntu-latest
## needs: dashboard
## if: ${{ always() }}
## steps:
## - name: Delete Previous deployments
## uses: actions/github-script@v6
## env:
## SHA_HEAD: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha}}
## with:
## script: |
## const { SHA_HEAD } = process.env
##
## const deployments = await github.rest.repos.listDeployments({
## owner: context.repo.owner,
## repo: context.repo.repo,
## sha: SHA_HEAD
## });
## await Promise.all(
## deployments.data.map(async (deployment) => {
## await github.rest.repos.createDeploymentStatus({
## owner: context.repo.owner,
## repo: context.repo.repo,
## deployment_id: deployment.id,
## state: 'inactive'
## });
## return github.rest.repos.deleteDeployment({
## owner: context.repo.owner,
## repo: context.repo.repo,
## deployment_id: deployment.id
## });
## })
## );
#
## A workflow run is made up of one or more jobs that can run sequentially or in parallel
#jobs:
# dashboard:
# # The type of runner that the job will run on
# runs-on: ubuntu-22.04
#
# strategy:
# matrix:
# environment: [prod]
# environment:
# name: ${{ matrix.environment }}
# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# - name: Checkout
# id: checkout
# # from https://github.com/actions/checkout/commits/main
# uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707
# with:
# persist-credentials: false
#
# # from https://github.com/pagopa/opex-dashboard-azure-action/
# - uses: pagopa/[email protected]
# with:
# environment: ${{ matrix.environment }}
# api-name:
# config: .opex/env/${{ matrix.environment }}/config.yaml
# client-id: ${{ secrets.CLIENT_ID }}
# tenant-id: ${{ secrets.TENANT_ID }}
# subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
# # from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
# docker-version: sha256:e4245954566cd3470e1b5527d33bb58ca132ce7493eac01be9e808fd25a11c8d
#
# delete_github_deployments:
# runs-on: ubuntu-latest
# needs: dashboard
# if: ${{ always() }}
# steps:
# - name: Delete Previous deployments
# uses: actions/github-script@v6
# env:
# SHA_HEAD: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha}}
# with:
# script: |
# const { SHA_HEAD } = process.env
#
# const deployments = await github.rest.repos.listDeployments({
# owner: context.repo.owner,
# repo: context.repo.repo,
# sha: SHA_HEAD
# });
# await Promise.all(
# deployments.data.map(async (deployment) => {
# await github.rest.repos.createDeploymentStatus({
# owner: context.repo.owner,
# repo: context.repo.repo,
# deployment_id: deployment.id,
# state: 'inactive'
# });
# return github.rest.repos.deleteDeployment({
# owner: context.repo.owner,
# repo: context.repo.repo,
# deployment_id: deployment.id
# });
# })
# );