Skip to content

Commit

Permalink
Try to use the github context
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Apr 16, 2021
1 parent eca075c commit 45b0112
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Expand Up @@ -12,16 +12,17 @@ jobs:
TESTS_FILE_PATH: .\install\Tests.exe
VERSION_HEADER_FILE: include\version.h
BUILD_CONFIGURATION: Release
SHA7: ${GITHUB_SHA::7}
SHA: ${{github.sha}}

steps:
- uses: actions/checkout@v2

- name: Inject commit hash in version.h Header
run: |
Write-Host "Writing {$env:SHA7} to {{$env:VERSION_HEADER_FILE}}"
$replaced = Get-Content {{$env:VERSION_HEADER_FILE}} | % { if ($_ -match '#define RADIANT_VERSION "\d+.\d+.\d+([\w\d]*)"') { $_.Replace($matches[1], "rev{{$env:SHA7}}") } else { $_ } };
$replaced | Out-File {{$env:VERSION_HEADER_FILE}}
$sha = $env:SHA.Substring(0, 7)
Write-Host "Writing $sha to {$env:VERSION_HEADER_FILE}"
$replaced = Get-Content {$env:VERSION_HEADER_FILE} | % { if ($_ -match '#define RADIANT_VERSION "\d+.\d+.\d+([\w\d]*)"') { $_.Replace($matches[1], "rev$sha") } else { $_ } };
$replaced | Out-File {$env:VERSION_HEADER_FILE}
shell: powershell

- name: Add MSBuild to PATH
Expand Down

0 comments on commit 45b0112

Please sign in to comment.