Added Moved to AVM for migrate modules (#4495) #967
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: | |
# 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' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'modules/**/main.bicep' | |
- 'modules/**/main.json' | |
- 'utilities/tools/platform/**' | |
env: | |
pipelinePrincipalGitUserName: 'CARMLPipelinePrincipal' | |
pipelinePrincipalGitUserEmail: 'CARML@noreply.github.com' | |
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-latest | |
name: 'Update status tables' | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: '${{ secrets.PLATFORM_REPO_UPDATE_PAT }}' # Sets general GIT credentials up | |
# Update the root ReadMe Module Pipelines table ([`/README.md`](https://github.com/Azure/ResourceModules/blob/main/README.md)) | |
- name: 'Update front-page module table' | |
shell: pwsh | |
run: | | |
# Load used functions | |
. (Join-Path $env:GITHUB_WORKSPACE $env:relativeScriptPath_SetReadMeModuleTable) | |
$functionInput = @{ | |
ModulesPath = Join-Path $env:GITHUB_WORKSPACE 'modules' | |
FilePath = Join-Path $env:GITHUB_WORKSPACE 'README.md' | |
Organization = ($env:GITHUB_REPOSITORY).split('/')[0] | |
RepositoryName = ($env:GITHUB_REPOSITORY).split('/')[1] | |
ColumnsInOrder = @('ProviderNamespace','ResourceType', 'Name', 'Deploy') | |
Environment = 'GitHub' | |
} | |
Write-Verbose "Invoke task with" -Verbose | |
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose | |
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: | | |
# Load used functions | |
. (Join-Path $env:GITHUB_WORKSPACE $env:relativeScriptPath_SetModuleOverviewTable) | |
$functionInput = @{ | |
MarkdownFilePath = Join-Path $env:GITHUB_WORKSPACE 'docs' 'wiki' 'The library - Module overview.md' | |
ModuleFolderPath = Join-Path $env:GITHUB_WORKSPACE 'modules' | |
Organization = ($env:GITHUB_REPOSITORY).split('/')[0] | |
RepositoryName = ($env:GITHUB_REPOSITORY).split('/')[1] | |
Environment = 'GitHub' | |
} | |
Write-Verbose "Invoke task with" -Verbose | |
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose | |
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: | | |
git config --global user.email '${{ env.pipelinePrincipalGitUserEmail }}' | |
git config --global user.name '${{ env.pipelinePrincipalGitUserName }}' | |
git pull | |
git add . | |
git commit -m "Push updated Readme file(s)" | |
git push |