diff --git a/.github/workflows/msptool.yml b/.github/workflows/msptool.yml index d074ca6..fa8c590 100644 --- a/.github/workflows/msptool.yml +++ b/.github/workflows/msptool.yml @@ -45,22 +45,21 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Update version number + shell: pwsh run: | - version=$(cat ${{ env.Version_File }}) - - IFS='.' read -r -a version_parts <<< "$version" - major=${version_parts[0]} - minor=${version_parts[1]} - patch=${version_parts[2]} - build=${version_parts[3]} - - build=$((build + 1)) - - new_version="$major.$minor.$patch.$build" - - echo "$new_version" > ${{ env.Version_File }} - - sed -i "s/private static readonly string vloc1 = \".*\";/private static readonly string vloc1 = \"$new_version\";/" ${{ env.Program_File }} + $version = Get-Content $env:Version_File + $version_parts = $version -split '\.' + + $major = $version_parts[0] + $minor = $version_parts[1] + $patch = $version_parts[2] + $build = [int]$version_parts[3] + 1 + + $new_version = "$major.$minor.$patch.$build" + + Set-Content -Path $env:Version_File -Value $new_version + + (Get-Content $env:Program_File) -replace 'private static readonly string vloc1 = ".*";', "private static readonly string vloc1 = `"$new_version`";" | Set-Content -Path $env:Program_File - name: Commit version updates run: | @@ -75,7 +74,7 @@ jobs: with: files: ${{ env.Solution_Directory }}/**/bin/${{ matrix.configuration }}/** env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - name: Upload build artifacts uses: actions/upload-artifact@v3