Upload the build output of pull requests (#122)

* Upload the build output of pull requests

* Fix incorrect commit sha
This commit is contained in:
Gerhard Tan
2024-02-17 20:44:38 +08:00
committed by GitHub
parent 26186cadbf
commit e4822ac7cb
4 changed files with 31 additions and 8 deletions

View File

@ -25,10 +25,32 @@ jobs:
run: |
for /f "usebackq delims=" %%i in (`vswhere.exe -latest -property installationPath`) do echo %%i\VC\Auxiliary\Build>>%GITHUB_PATH%
- name: Add commit hash to version number
shell: powershell
if: github.event_name == 'pull_request'
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
$versionFile = ".\pkg\version\version.go"
$rev = [UInt16]("0x" + $env:HEAD_SHA.Substring(0, 4))
$version = (findstr /r "Number.*=.*[0-9.]*" $versionFile | Select-Object -First 1 | ConvertFrom-StringData).Get_Item("Number")
$newVersion = $version.Substring(0, $version.Length - 1) + ".$rev" + '"'
(Get-Content $versionFile).Replace($version, $newVersion) | Set-Content $versionFile
- name: Build
shell: cmd
run: build.bat
- name: Upload
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: build
path: |
bin/*.exe
bin/*.zip
retention-days: 5
test:
name: Go
runs-on: windows-latest