=BOM to ANSI file type #3
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 Version Badge | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'VsDevShellManager.ps1' | |
| jobs: | |
| update-badge: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Extract Version from Script | |
| id: get_version | |
| shell: pwsh | |
| run: | | |
| # Regex to find the $ScriptVersion value | |
| $content = Get-Content "VsDevShellManager.ps1" -Raw | |
| if ($content -match '\$ScriptVersion\s*=\s*"([^"]+)"') { | |
| $version = $matches[1] | |
| echo "VERSION=$version" >> $env:GITHUB_OUTPUT | |
| } | |
| - name: Update JSON file | |
| shell: pwsh | |
| run: | | |
| $version = "${{ steps.get_version.outputs.VERSION }}" | |
| $json = Get-Content "version.json" | ConvertFrom-Json | |
| $json.message = $version | |
| $json | ConvertTo-Json | Out-File "version.json" | |
| - name: Commit and Push Changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add version.json | |
| git commit -m "chore: auto-update version to ${{ steps.get_version.outputs.VERSION }}" || exit 0 | |
| git push |