Skip to content

Commit f16d6a9

Browse files
AlexanderSehrCARMLPipelinePrincipal
andauthored
[CI Environment] Added utility to automatically add & update all platform pipelines to the main readme (#2610)
* Update to latest * Further updates to logic * Further updates * Small docs update * Updated pipeline templates * Updated pipeline templates * Updated docs * Updated docs * Added missing ref * Push updated Readme file(s) * Push updated Readme file(s) * Adjusted url gen * Push updated Readme file(s) * Added pipe name * Split URI gen * Update to latest * Push updated Readme file(s) * Push updated Readme file(s) * Renamed pipeline Co-authored-by: CARMLPipelinePrincipal <CARML@noreply.github.com>
1 parent 91831af commit f16d6a9

11 files changed

Lines changed: 482 additions & 250 deletions

.azuredevops/platformPipelines/platform.updateReadMe.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ variables:
2323
value: 'utilities/tools/platform/Set-ReadMeModuleTable.ps1'
2424
- name: relativeScriptPath_SetModuleOverviewTable
2525
value: 'utilities/tools/platform/Set-ModuleOverviewTable.ps1'
26+
- name: relativeScriptPath_SetReadMePlatformTable
27+
value: 'utilities/tools/platform/Set-ReadMePlatformTable.ps1'
2628

2729
jobs:
28-
- job: Update_module_tables
30+
- job: Update_status_tables
31+
displayName: Update status tables
2932
pool:
3033
${{ if ne(variables.vmImage, '') }}:
3134
vmImage: ${{ variables.vmImage }}
@@ -34,8 +37,10 @@ jobs:
3437
steps:
3538
- checkout: self
3639
persistCredentials: true
40+
41+
# Update the root ReadMe Module Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
3742
- task: PowerShell@2
38-
displayName: 'Update general ReadMe'
43+
displayName: 'Update Module Pipelines table'
3944
inputs:
4045
targetType: inline
4146
pwsh: true
@@ -58,6 +63,8 @@ jobs:
5863
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
5964
6065
Set-ReadMeModuleTable @functionInput -Verbose
66+
67+
# Update the `modules` folder ReadMe ([`/modules/readme.md`](https://github.com/Azure/ResourceModules/blob/main/modules/README.md))
6168
- task: PowerShell@2
6269
displayName: 'Update module folder ReadMe'
6370
inputs:
@@ -82,6 +89,7 @@ jobs:
8289
8390
Set-ReadMeModuleTable @functionInput -Verbose
8491
92+
# Update the module overview table ([`/docs/wiki/The library - Module overview.md`](https://github.com/Azure/ResourceModules/wiki/The%20library%20-%20Module%20overview))
8593
- task: PowerShell@2
8694
displayName: 'Update module outline'
8795
inputs:
@@ -101,6 +109,29 @@ jobs:
101109
102110
Set-ModuleOverviewTable @functionInput -Verbose
103111
112+
# Update the root ReadMe Platform Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
113+
- task: PowerShell@2
114+
displayName: 'Update Platform Pipelines table'
115+
inputs:
116+
targetType: inline
117+
pwsh: true
118+
script: |
119+
# Load used functions
120+
. (Join-Path '$(System.DefaultWorkingDirectory)' '$(relativeScriptPath_SetReadMePlatformTable)')
121+
122+
$functionInput = @{
123+
FilePath = Join-Path '$(System.DefaultWorkingDirectory)' 'README.md'
124+
RepositoryName = '$(Build.Repository.Name)'
125+
Organization = '$(System.CollectionUri)'.Split('/')[3]
126+
ProjectName = '$(System.TeamProject)'
127+
Environment = 'ADO'
128+
}
129+
130+
Write-Verbose "Invoke task with" -Verbose
131+
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
132+
133+
Set-ReadMePlatformTable @functionInput -Verbose
134+
104135
- task: PowerShell@2
105136
displayName: 'Push changes'
106137
inputs:

.github/workflows/platform.updateReadMe.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This pipeline requires a secret 'PLATFORM_REPO_UPDATE_PAT' set up in the GitHub secrets.
33
# The secret's value should be a PAT token with the permissions to push to the repository's main branch.
44

5-
name: '.Platform: Update ReadMe Module Tables'
5+
name: '.Platform: Update ReadMe status Tables'
66

77
on:
88
workflow_dispatch:
@@ -19,18 +19,21 @@ env:
1919
pipelinePrincipalGitUserEmail: 'CARML@noreply.github.com'
2020
relativeScriptPath_SetReadMeModuleTable: 'utilities/tools/platform/Set-ReadMeModuleTable.ps1'
2121
relativeScriptPath_SetModuleOverviewTable: 'utilities/tools/platform/Set-ModuleOverviewTable.ps1'
22+
relativeScriptPath_SetReadMePlatformTable: 'utilities/tools/platform/Set-ReadMePlatformTable.ps1'
2223

2324
jobs:
2425
job_update_readme:
2526
runs-on: ubuntu-20.04
26-
name: 'Update module tables'
27+
name: 'Update status tables'
2728
steps:
2829
- name: 'Checkout'
2930
uses: actions/checkout@v3
3031
with:
3132
fetch-depth: 0
3233
token: '${{ secrets.PLATFORM_REPO_UPDATE_PAT }}' # Sets general GIT credentials up
33-
- name: 'Update general ReadMe'
34+
35+
# Update the root ReadMe Module Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
36+
- name: 'Update Module Pipelines table'
3437
shell: pwsh
3538
run: |
3639
# Load used functions
@@ -51,6 +54,7 @@ jobs:
5154
5255
Set-ReadMeModuleTable @functionInput -Verbose
5356
57+
# Update the `modules` folder ReadMe ([`/modules/readme.md`](https://github.com/Azure/ResourceModules/blob/main/modules/README.md))
5458
- name: 'Update module folder ReadMe'
5559
shell: pwsh
5660
run: |
@@ -71,6 +75,7 @@ jobs:
7175
7276
Set-ReadMeModuleTable @functionInput -Verbose
7377
78+
# Update the module overview table ([`/docs/wiki/The library - Module overview.md`](https://github.com/Azure/ResourceModules/wiki/The%20library%20-%20Module%20overview))
7479
- name: 'Update module outline'
7580
shell: pwsh
7681
run: |
@@ -87,6 +92,25 @@ jobs:
8792
8893
Set-ModuleOverviewTable @functionInput -Verbose
8994
95+
# Update the root ReadMe Platform Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
96+
- name: 'Update Platform Pipelines table'
97+
shell: pwsh
98+
run: |
99+
# Load used functions
100+
. (Join-Path $env:GITHUB_WORKSPACE $env:relativeScriptPath_SetReadMePlatformTable)
101+
102+
$functionInput = @{
103+
FilePath = Join-Path $env:GITHUB_WORKSPACE 'README.md'
104+
RepositoryName = ($env:GITHUB_REPOSITORY).split('/')[1]
105+
Organization = ($env:GITHUB_REPOSITORY).split('/')[0]
106+
Environment = 'GitHub'
107+
}
108+
109+
Write-Verbose "Invoke task with" -Verbose
110+
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
111+
112+
Set-ReadMePlatformTable @functionInput -Verbose
113+
90114
- name: 'Push changes'
91115
shell: pwsh
92116
run: |

0 commit comments

Comments
 (0)