Skip to content

Update main.cpp

Update main.cpp #19

Workflow file for this run

name: Build and Upload to Buildbot
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install vpatch
run: dotnet tool install --global Nefarius.Tools.Vpatch
- name: Stamp version in resource file
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$semverPattern = '^v?(\d+)\.(\d+)\.(\d+)(?:-(.+))?$'
if ($tag -notmatch $semverPattern) {
Write-Error "Tag '$tag' does not match semantic version pattern (e.g. v1.2.3 or v1.2.3-rc1). Expected: ^v?(\d+)\.(\d+)\.(\d+)(?:-(.+))?$"
exit 1
}
$major = $Matches[1]
$minor = $Matches[2]
$patch = $Matches[3]
$versionNumeric = "$major.$minor.$patch.0"
vpatch --stamp-version $versionNumeric --target-file "res\app.rc" --resource.file-version --resource.product-version
- name: Bootstrap vcpkg
run: vcpkg/bootstrap-vcpkg.bat
- name: Get GameInput SDK
shell: pwsh
run: |
$version = "3.3.163"
$nupkgUrl = "https://api.nuget.org/v3-flatcontainer/microsoft.gameinput/$version/microsoft.gameinput.$version.nupkg"
$sdkDir = "$env:RUNNER_TEMP\GameInputSdk"
New-Item -ItemType Directory -Path $sdkDir -Force | Out-Null
$nupkgPath = "$sdkDir\microsoft.gameinput.$version.nupkg"
Invoke-WebRequest -Uri $nupkgUrl -OutFile $nupkgPath -UseBasicParsing
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($nupkgPath, $sdkDir)
Remove-Item $nupkgPath -Force
$nativePath = "$sdkDir\build\native"
if (-not (Test-Path $nativePath)) {
$subdir = Get-ChildItem -Path $sdkDir -Directory | Select-Object -First 1
if ($subdir) { $nativePath = (Join-Path $subdir.FullName "build\native") }
}
if (-not (Test-Path $nativePath)) {
Write-Error "GameInput SDK build/native not found under $sdkDir"
exit 1
}
$nativePath = (Resolve-Path $nativePath).Path
echo "GAMEINPUT_ROOT=$nativePath" >> $env:GITHUB_ENV
- name: Configure
run: cmake --preset default -DUSE_GAMEINPUT=ON -DGAMEINPUT_ROOT=$env:GAMEINPUT_ROOT
- name: Build Release
run: cmake --build --preset release
- name: Upload artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: build/Release/**
- name: Send webhook
shell: bash
run: |
artifact_name="${{ github.event.repository.name }}"
artifact_id="${{ steps.upload.outputs.artifact-id }}"
artifact_url="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${artifact_id}/zip"
payload=$(jq -n \
--arg fileName "${artifact_name}.zip" \
--arg url "$artifact_url" \
--arg projectName "${{ github.event.repository.name }}" \
--arg branch "${{ github.ref_name }}" \
--arg buildVersion "${{ github.ref_name }}" \
'{
artifacts: [
{
fileName: $fileName,
url: $url
}
],
environmentVariables: {
appveyor_project_name: $projectName,
appveyor_repo_branch: $branch,
appveyor_build_version: $buildVersion
}
}')
curl -X POST "${{ secrets.WEBHOOK_URL }}" \
-H "Content-Type: application/json" \
-H "X-GitHub-Token: ${{ secrets.GITHUB_TOKEN }}" \
-d "$payload"