Skip to content

Commit

Permalink
[CI Environment] Added utility to automatically add & update all plat…
Browse files Browse the repository at this point in the history
…form 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 <[email protected]>
  • Loading branch information
AlexanderSehr and CARMLPipelinePrincipal authored Jan 24, 2023
1 parent 91831af commit f16d6a9
Show file tree
Hide file tree
Showing 11 changed files with 482 additions and 250 deletions.
35 changes: 33 additions & 2 deletions .azuredevops/platformPipelines/platform.updateReadMe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ variables:
value: 'utilities/tools/platform/Set-ReadMeModuleTable.ps1'
- name: relativeScriptPath_SetModuleOverviewTable
value: 'utilities/tools/platform/Set-ModuleOverviewTable.ps1'
- name: relativeScriptPath_SetReadMePlatformTable
value: 'utilities/tools/platform/Set-ReadMePlatformTable.ps1'

jobs:
- job: Update_module_tables
- job: Update_status_tables
displayName: Update status tables
pool:
${{ if ne(variables.vmImage, '') }}:
vmImage: ${{ variables.vmImage }}
Expand All @@ -34,8 +37,10 @@ jobs:
steps:
- checkout: self
persistCredentials: true

# Update the root ReadMe Module Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
- task: PowerShell@2
displayName: 'Update general ReadMe'
displayName: 'Update Module Pipelines table'
inputs:
targetType: inline
pwsh: true
Expand All @@ -58,6 +63,8 @@ jobs:
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Set-ReadMeModuleTable @functionInput -Verbose
# Update the `modules` folder ReadMe ([`/modules/readme.md`](https://github.com/Azure/ResourceModules/blob/main/modules/README.md))
- task: PowerShell@2
displayName: 'Update module folder ReadMe'
inputs:
Expand All @@ -82,6 +89,7 @@ jobs:
Set-ReadMeModuleTable @functionInput -Verbose
# Update the module overview table ([`/docs/wiki/The library - Module overview.md`](https://github.com/Azure/ResourceModules/wiki/The%20library%20-%20Module%20overview))
- task: PowerShell@2
displayName: 'Update module outline'
inputs:
Expand All @@ -101,6 +109,29 @@ jobs:
Set-ModuleOverviewTable @functionInput -Verbose
# Update the root ReadMe Platform Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
- task: PowerShell@2
displayName: 'Update Platform Pipelines table'
inputs:
targetType: inline
pwsh: true
script: |
# Load used functions
. (Join-Path '$(System.DefaultWorkingDirectory)' '$(relativeScriptPath_SetReadMePlatformTable)')
$functionInput = @{
FilePath = Join-Path '$(System.DefaultWorkingDirectory)' 'README.md'
RepositoryName = '$(Build.Repository.Name)'
Organization = '$(System.CollectionUri)'.Split('/')[3]
ProjectName = '$(System.TeamProject)'
Environment = 'ADO'
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Set-ReadMePlatformTable @functionInput -Verbose
- task: PowerShell@2
displayName: 'Push changes'
inputs:
Expand Down
30 changes: 27 additions & 3 deletions .github/workflows/platform.updateReadMe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This pipeline requires a secret 'PLATFORM_REPO_UPDATE_PAT' set up in the GitHub secrets.
# The secret's value should be a PAT token with the permissions to push to the repository's main branch.

name: '.Platform: Update ReadMe Module Tables'
name: '.Platform: Update ReadMe status Tables'

on:
workflow_dispatch:
Expand All @@ -19,18 +19,21 @@ env:
pipelinePrincipalGitUserEmail: '[email protected]'
relativeScriptPath_SetReadMeModuleTable: 'utilities/tools/platform/Set-ReadMeModuleTable.ps1'
relativeScriptPath_SetModuleOverviewTable: 'utilities/tools/platform/Set-ModuleOverviewTable.ps1'
relativeScriptPath_SetReadMePlatformTable: 'utilities/tools/platform/Set-ReadMePlatformTable.ps1'

jobs:
job_update_readme:
runs-on: ubuntu-20.04
name: 'Update module tables'
name: 'Update status tables'
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
token: '${{ secrets.PLATFORM_REPO_UPDATE_PAT }}' # Sets general GIT credentials up
- name: 'Update general ReadMe'

# Update the root ReadMe Module Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
- name: 'Update Module Pipelines table'
shell: pwsh
run: |
# Load used functions
Expand All @@ -51,6 +54,7 @@ jobs:
Set-ReadMeModuleTable @functionInput -Verbose
# Update the `modules` folder ReadMe ([`/modules/readme.md`](https://github.com/Azure/ResourceModules/blob/main/modules/README.md))
- name: 'Update module folder ReadMe'
shell: pwsh
run: |
Expand All @@ -71,6 +75,7 @@ jobs:
Set-ReadMeModuleTable @functionInput -Verbose
# Update the module overview table ([`/docs/wiki/The library - Module overview.md`](https://github.com/Azure/ResourceModules/wiki/The%20library%20-%20Module%20overview))
- name: 'Update module outline'
shell: pwsh
run: |
Expand All @@ -87,6 +92,25 @@ jobs:
Set-ModuleOverviewTable @functionInput -Verbose
# Update the root ReadMe Platform Pipelines table ([`/readme.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
- name: 'Update Platform Pipelines table'
shell: pwsh
run: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE $env:relativeScriptPath_SetReadMePlatformTable)
$functionInput = @{
FilePath = Join-Path $env:GITHUB_WORKSPACE 'README.md'
RepositoryName = ($env:GITHUB_REPOSITORY).split('/')[1]
Organization = ($env:GITHUB_REPOSITORY).split('/')[0]
Environment = 'GitHub'
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Set-ReadMePlatformTable @functionInput -Verbose
- name: 'Push changes'
shell: pwsh
run: |
Expand Down
Loading

0 comments on commit f16d6a9

Please sign in to comment.