Skip to content

PropertyIsVisible and PropertyIsReadOnly callbacks #75

PropertyIsVisible and PropertyIsReadOnly callbacks

PropertyIsVisible and PropertyIsReadOnly callbacks #75

name: "Build Win64 DX12"
on:
workflow_dispatch:
push:
paths:
- "src/version.h"
env:
SOLUTION_FILE_PATH: vgframework.sln
BUILD_PLATFORM: '"Win64 DX12"'
permissions:
contents: write
jobs:
build_editor:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[17.11.2, 18.0.0)'
- name: Restore NuGet packages
run: nuget restore ${{ env.SOLUTION_FILE_PATH }}
- name: Build Release
run: msbuild /m /p:Configuration=Release /p:Platform=${{ env.BUILD_PLATFORM }} ${{ env.SOLUTION_FILE_PATH }}
- name: Upload Release Artifacts
if: success()
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: |
src/commit.h
VGFramework_x64_Release_DX12.exe
build\bin\x64\Release\audio.dll
build\bin\x64\Release\editor.dll
build\bin\x64\Release\engine.dll
build\bin\x64\Release\game.dll
build\bin\x64\Release\physics.dll
build\bin\x64\Release_DX12\renderer.dll
build_game:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[17.11.2, 18.0.0)'
- name: Restore NuGet packages
run: nuget restore ${{ env.SOLUTION_FILE_PATH }}
- name: Build Final
run: msbuild /m /p:Configuration=Final /p:Platform=${{ env.BUILD_PLATFORM }} ${{ env.SOLUTION_FILE_PATH }}
- name: Upload Final Artifacts
if: success()
uses: actions/upload-artifact@v3
with:
name: final-artifacts
path: |
src/commit.h
VGFramework_x64_Final_DX12.exe
build\bin\x64\Final\audio.dll
build\bin\x64\Final\engine.dll
build\bin\x64\Final\game.dll
build\bin\x64\Final\physics.dll
build\bin\x64\Final_DX12\renderer.dll
submit_binaries:
runs-on: windows-latest
needs: [build_editor, build_game]
steps:
- uses: actions/checkout@v4
- name: Download Release Artifacts
uses: actions/download-artifact@v3
with:
name: release-artifacts
path: ${{ env.GITHUB_WORKSPACE }}
- name: Download Final Artifacts
uses: actions/download-artifact@v3
with:
name: final-artifacts
path: ${{ env.GITHUB_WORKSPACE }}
- name: Read version, copy client files, and push binaries
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
# Read GIT_REVISION from commit.h
$versionContent = Get-Content "src/commit.h"
$gitRevision = ""
foreach ($line in $versionContent) {
if ($line -like '*#define GIT_REVISION*') {
$parts = $line -split '"'
$gitRevision = $parts[1]
break
}
}
# Read version from version.h
$versionContent = Get-Content "src/version.h"
$major, $minor, $patch = "", "", ""
foreach ($line in $versionContent) {
if ($line -match '#define VG_FRAMEWORK_VERSION_MAJOR (\d+)') {
$major = $matches[1]
} elseif ($line -match '#define VG_FRAMEWORK_VERSION_MINOR (\d+)') {
$minor = $matches[1]
} elseif ($line -match '#define VG_FRAMEWORK_VERSION_PATCH (\d+)') {
$patch = $matches[1]
}
}
$fullVersion = "$major.$minor.$patch"
$commitMessage = "Editor and Game $fullVersion ($gitRevision)"
Write-Host "Commit message: $commitMessage"
# Run the batch file to create client file copies
cmd /c script\copy_client_files.bat
# Configure Git and push changes
git config user.name "VGF_Boy"
git config user.email "[email protected]"
# Stage Editor files
git add -f "Editor.exe"
git add -f "bin\x64\Release\audio.dll"
git add -f "bin\x64\Release\editor.dll"
git add -f "bin\x64\Release\engine.dll"
git add -f "bin\x64\Release\game.dll"
git add -f "bin\x64\Release\physics.dll"
git add -f "bin\x64\Release_DX12\renderer.dll"
# Stage Game files
git add -f "Game.exe"
git add -f "bin\x64\Final\audio.dll"
git add -f "bin\x64\Final\engine.dll"
git add -f "bin\x64\Final\game.dll"
git add -f "bin\x64\Final\physics.dll"
git add -f "bin\x64\Final_DX12\renderer.dll"
git commit -m "$commitMessage"
git push
- name: Send Discord Notification
shell: pwsh
run: |
$DISCORD_RELEASE_WEBHOOK_URL = "${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}"
$jobName = "${{ github.job }}"
$runId = "${{ github.run_id }}"
$repo = "${{ github.repository }}"
$serverUrl = "${{ github.server_url }}"
$jobsApiUrl = "https://api.github.com/repos/$repo/actions/runs/$runId/jobs"
$jobId = (curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $jobsApiUrl | ConvertFrom-Json).jobs | Where-Object { $_.name -eq $jobName } | Select-Object -ExpandProperty id
$jobUrl = "$serverUrl/$repo/actions/runs/$runId/job/$jobId"
$commitSha = "${{ github.sha }}"
$shortCommitSha = $commitSha.Substring(0, 7)
$versionContent = Get-Content "src/version.h"
$major, $minor, $patch = "", "", ""
foreach ($line in $versionContent) {
if ($line -match '#define VG_FRAMEWORK_VERSION_MAJOR (\d+)') {
$major = $matches[1]
} elseif ($line -match '#define VG_FRAMEWORK_VERSION_MINOR (\d+)') {
$minor = $matches[1]
} elseif ($line -match '#define VG_FRAMEWORK_VERSION_PATCH (\d+)') {
$patch = $matches[1]
}
}
$fullVersion = "$major.$minor.$patch"
$commitContent = Get-Content "src/commit.h"
$gitRevision = ""
foreach ($line in $commitContent) {
if ($line -like '*#define GIT_REVISION*') {
$parts = $line -split '"'
$gitRevision = $parts[1]
break
}
}
$jsonPayload = @"
{
"username": "VGF_Boy",
"content": "",
"embeds": [
{
"type": "rich",
"title": "VGFramework $fullVersion ``$gitRevision``",
"description": "A new version of VGFramework is available",
"color": 15579707,
"thumbnail": {
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/version.png?raw=true"
},
"author": {
"name": "$($env:GITHUB_ACTOR)",
"url": "https://github.com/$($env:GITHUB_ACTOR)",
"icon_url": "https://avatars.githubusercontent.com/u/$($env:GITHUB_ACTOR_ID)?v=4"
},
"url": "$jobUrl"
}
]
}
"@
# Send the notification using curl
$RESPONSE = curl -H "Content-Type: application/json" -X POST -d $jsonPayload $DISCORD_RELEASE_WEBHOOK_URL
# Output the response from the server
Write-Output "Webhook server response: $RESPONSE"