Update module manifest #1554
This file contains hidden or 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
| name: Update module manifest | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ development ] | |
| paths: | |
| - ci/Update-Manifest.ps1 | |
| schedule: | |
| - cron: '0 18 * * *' | |
| env: | |
| MANIFEST_FILE: ${{ github.workspace }}\VcRedist\VisualCRedistributables.json | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| validate-amd64: | |
| runs-on: windows-latest | |
| outputs: | |
| changes_detected: ${{ steps.commit.outputs.changes_detected }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: development | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Import GPG key so that we can sign the commit | |
| - name: Import GPG key | |
| id: import_gpg | |
| uses: crazy-max/ghaction-import-gpg@v7 | |
| with: | |
| gpg_private_key: ${{ secrets.GPGKEY }} | |
| passphrase: ${{ secrets.GPGPASSPHRASE }} | |
| git_user_signingkey: true | |
| git_commit_gpgsign: true | |
| git_config_global: true | |
| git_tag_gpgsign: true | |
| git_push_gpgsign: false | |
| git_committer_name: ${{ secrets.COMMIT_NAME }} | |
| git_committer_email: ${{ secrets.COMMIT_EMAIL }} | |
| # Uninstall existing VcRedists | |
| - name: Uninstall VcRedists | |
| shell: pwsh | |
| run: | | |
| Import-Module ${{ github.workspace }}\VcRedist -Force | |
| Get-InstalledVcRedist | Uninstall-VcRedist -Confirm:$False -Verbose | |
| # Validate VcRedist 2017 and update the manifest | |
| - name: Validate VcRedist 2017 | |
| shell: pwsh | |
| run: | | |
| $Release = "2017" | |
| Import-Module "${{ github.workspace }}\VcRedist" -Force | |
| New-Item -Path "$env:RUNNER_TEMP\VcRedist" -ItemType "Directory" -ErrorAction "SilentlyContinue" | Out-Null | |
| Get-VcList -Release $Release | Save-VcRedist -Path "$env:RUNNER_TEMP\VcRedist" | Install-VcRedist | |
| $params = @{ | |
| Release = $Release | |
| Path = "$env:RUNNER_TEMP\VcRedist" | |
| VcManifest = "${{ env.MANIFEST_FILE }}" | |
| } | |
| . ${{ github.workspace }}\ci\Update-Manifest.ps1 @params | |
| # Validate VcRedist 2019 and update the manifest | |
| - name: Validate VcRedist 2019 | |
| shell: pwsh | |
| run: | | |
| $Release = "2019" | |
| Import-Module "${{ github.workspace }}\VcRedist" -Force | |
| New-Item -Path "$env:RUNNER_TEMP\VcRedist" -ItemType "Directory" -ErrorAction "SilentlyContinue" | Out-Null | |
| Get-VcList -Release $Release | Save-VcRedist -Path "$env:RUNNER_TEMP\VcRedist" | Install-VcRedist | |
| $params = @{ | |
| Release = $Release | |
| Path = "$env:RUNNER_TEMP\VcRedist" | |
| VcManifest = "${{ env.MANIFEST_FILE }}" | |
| } | |
| . ${{ github.workspace }}\ci\Update-Manifest.ps1 @params | |
| # Validate VcRedist 14 and update the manifest | |
| - name: Validate VcRedist 14 | |
| shell: pwsh | |
| run: | | |
| $Release = "14" | |
| Import-Module "${{ github.workspace }}\VcRedist" -Force | |
| New-Item -Path "$env:RUNNER_TEMP\VcRedist" -ItemType "Directory" -ErrorAction "SilentlyContinue" | Out-Null | |
| Get-VcList -Release $Release | Save-VcRedist -Path "$env:RUNNER_TEMP\VcRedist" | Install-VcRedist | |
| $params = @{ | |
| Release = $Release | |
| Path = "$env:RUNNER_TEMP\VcRedist" | |
| VcManifest = "${{ env.MANIFEST_FILE }}" | |
| } | |
| . ${{ github.workspace }}\ci\Update-Manifest.ps1 @params | |
| # Format the date number for the commit message | |
| - name: Get date | |
| id: get-date | |
| shell: pwsh | |
| run: | | |
| echo "date=$(Get-Date -Format "yyyy-MM-dd")" >> $env:GITHUB_OUTPUT | |
| # Commit changes to the manifest | |
| - name: Commit changes | |
| id: commit | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "Update manifest ${{ steps.get-date.outputs.date }}.${{ github.run_number }}" | |
| commit_user_name: ${{ secrets.COMMIT_NAME }} | |
| commit_user_email: ${{ secrets.COMMIT_EMAIL }} | |
| - name: "Run if changes have been detected" | |
| if: steps.commit.outputs.changes_detected == 'true' | |
| run: echo "Changes committed." | |
| - name: "Run if no changes have been detected" | |
| if: steps.commit.outputs.changes_detected == 'false' | |
| run: echo "No changes detected." | |
| validate-arm64: | |
| runs-on: windows-11-arm | |
| needs: validate-amd64 | |
| outputs: | |
| changes_detected: ${{ steps.commit.outputs.changes_detected }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: development | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Pull latest changes from validate-amd64 job | |
| - name: Pull latest changes | |
| shell: pwsh | |
| run: | | |
| git pull origin development | |
| # Import GPG key so that we can sign the commit | |
| - name: Import GPG key | |
| id: import_gpg | |
| uses: crazy-max/ghaction-import-gpg@v7 | |
| with: | |
| gpg_private_key: ${{ secrets.GPGKEY }} | |
| passphrase: ${{ secrets.GPGPASSPHRASE }} | |
| git_user_signingkey: true | |
| git_commit_gpgsign: true | |
| git_config_global: true | |
| git_tag_gpgsign: true | |
| git_push_gpgsign: false | |
| git_committer_name: ${{ secrets.COMMIT_NAME }} | |
| git_committer_email: ${{ secrets.COMMIT_EMAIL }} | |
| # Uninstall existing VcRedists | |
| - name: Uninstall VcRedists | |
| shell: pwsh | |
| run: | | |
| Import-Module ${{ github.workspace }}\VcRedist -Force | |
| Get-InstalledVcRedist | Uninstall-VcRedist -Confirm:$False -Verbose | |
| # Validate VcRedist 14 and update the manifest | |
| - name: Validate VcRedist 14 | |
| shell: pwsh | |
| run: | | |
| $Release = "14" | |
| $Architecture = "arm64" | |
| Import-Module "${{ github.workspace }}\VcRedist" -Force | |
| New-Item -Path "$env:RUNNER_TEMP\VcRedist" -ItemType "Directory" -ErrorAction "SilentlyContinue" | Out-Null | |
| Get-VcList -Release $Release -Architecture $Architecture | Save-VcRedist -Path "$env:RUNNER_TEMP\VcRedist" | Install-VcRedist | |
| $params = @{ | |
| Release = $Release | |
| Architecture = $Architecture | |
| Path = "$env:RUNNER_TEMP\VcRedist" | |
| VcManifest = "${{ env.MANIFEST_FILE }}" | |
| } | |
| . ${{ github.workspace }}\ci\Update-Manifest.ps1 @params | |
| # Format the date number for the commit message | |
| - name: Get date | |
| id: get-date | |
| shell: pwsh | |
| run: | | |
| echo "date=$(Get-Date -Format "yyyy-MM-dd")" >> $env:GITHUB_OUTPUT | |
| # Commit changes to the manifest | |
| - name: Commit changes | |
| id: commit | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "Update manifest ARM64 ${{ steps.get-date.outputs.date }}.${{ github.run_number }}" | |
| commit_user_name: ${{ secrets.COMMIT_NAME }} | |
| commit_user_email: ${{ secrets.COMMIT_EMAIL }} | |
| - name: "Run if changes have been detected" | |
| if: steps.commit.outputs.changes_detected == 'true' | |
| run: echo "Changes committed." | |
| - name: "Run if no changes have been detected" | |
| if: steps.commit.outputs.changes_detected == 'false' | |
| run: echo "No changes detected." | |
| create-pull-request: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - validate-amd64 | |
| - validate-arm64 | |
| if: needs.validate-amd64.outputs.changes_detected == 'true' || needs.validate-arm64.outputs.changes_detected == 'true' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: development | |
| fetch-depth: 0 | |
| - name: Generate pull request body | |
| shell: bash | |
| run: | | |
| git fetch origin main --depth=1 | |
| { | |
| echo "## Automated manifest update" | |
| echo | |
| echo "This PR was created by workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| echo | |
| echo "### Commits in development not in main" | |
| if git log --oneline origin/main..HEAD | grep -q .; then | |
| git log --oneline origin/main..HEAD | |
| else | |
| echo "No commit summary available." | |
| fi | |
| echo | |
| echo "### Files changed (vs main)" | |
| if git diff --name-status origin/main...HEAD | grep -q .; then | |
| git diff --name-status origin/main...HEAD | |
| else | |
| echo "No file changes detected." | |
| fi | |
| } > pr-body.md | |
| - name: Create or update pull request to main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| TITLE="Automated manifest update (${GITHUB_RUN_NUMBER})" | |
| EXISTING_PR_NUMBER=$(gh pr list --base main --head development --state open --json number --jq '.[0].number') | |
| if [[ -n "$EXISTING_PR_NUMBER" ]]; then | |
| gh pr edit "$EXISTING_PR_NUMBER" --title "$TITLE" --body-file pr-body.md | |
| echo "Updated PR #$EXISTING_PR_NUMBER" | |
| else | |
| gh pr create --base main --head development --title "$TITLE" --body-file pr-body.md | |
| fi |