Update build.yml #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check-Build | |
| on: [push] | |
| jobs: | |
| build-publish: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download and extract plugins - [any] | |
| shell: pwsh | |
| run: | | |
| $plugins = @( | |
| "plugin_Kinect360NiTE", | |
| "plugin_OpenVR" | |
| ) | |
| New-Item -ItemType Directory -Force -Path artifacts | Out-Null | |
| New-Item -ItemType Directory -Force -Path Plugins_ANY | Out-Null | |
| foreach ($plugin in $plugins) { | |
| Write-Host "Downloading $plugin ..." | |
| gh release download --repo "KinectToVR/$plugin" --pattern "*.zip" --dir artifacts ame2-latest | |
| Get-ChildItem artifacts -Filter *.zip | ForEach-Object { | |
| $dest = "Plugins_ANY/$plugin" | |
| New-Item -ItemType Directory -Force -Path $dest | Out-Null | |
| Expand-Archive -Path $_.FullName -DestinationPath $dest -Force | |
| Remove-Item $_.FullName | |
| } | |
| } | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Download and extract plugins - [windows] | |
| shell: pwsh | |
| run: | | |
| $plugins = @( | |
| "plugin_Kinect360", | |
| "plugin_KinectOne", | |
| "plugin_owoTrackVR", | |
| "plugin_PSMoveService" | |
| ) | |
| New-Item -ItemType Directory -Force -Path artifacts | Out-Null | |
| New-Item -ItemType Directory -Force -Path Plugins_WINDOWS | Out-Null | |
| foreach ($plugin in $plugins) { | |
| Write-Host "Downloading $plugin ..." | |
| gh release download --repo "KinectToVR/$plugin" --pattern "*.zip" --dir artifacts ame-latest | |
| Get-ChildItem artifacts -Filter *.zip | ForEach-Object { | |
| $dest = "Plugins_WINDOWS/$plugin" | |
| New-Item -ItemType Directory -Force -Path $dest | Out-Null | |
| Expand-Archive -Path $_.FullName -DestinationPath $dest -Force | |
| Remove-Item $_.FullName | |
| } | |
| } | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Inject build commit hash | |
| shell: pwsh | |
| run: | | |
| (Get-Content Amethyst/Classes/AppData.cs) -replace 'AZ_BUILD_NUMBER', $env:GITHUB_SHA | Set-Content Amethyst/Classes/AppData.cs | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Restore and build (publish) - Linux | |
| run: | | |
| dotnet publish Amethyst.Desktop ` | |
| /p:Configuration=Release /p:TargetFramework=net8.0 /p:PublishProfile=FolderProfile ` | |
| /p:RuntimeIdentifier=linux-x64 /p:SelfContained=true /p:PublishDir=bin/Release/linux | |
| Copy-Item -Path "Plugins_ANY" -Destination "Amethyst.Desktop/bin/Release/linux/Plugins" -Recurse | |
| cd Amethyst.Desktop/bin/Release/linux/ | |
| 7z a AME2-$(Get-Date -Format 'yyyyMMdd')-LINUX.zip * | |
| - name: Restore and build (publish) - Windows | |
| run: | | |
| dotnet publish Amethyst.Desktop ` | |
| /p:Configuration=Release /p:TargetFramework=net8.0 /p:PublishProfile=FolderProfile ` | |
| /p:RuntimeIdentifier=win-x64 /p:SelfContained=true /p:PublishDir=bin/Release/windows | |
| Copy-Item -Path "Plugins_ANY" -Destination "Amethyst.Desktop/bin/Release/windows/Plugins" -Recurse | |
| Copy-Item -Path "Plugins_WINDOWS" -Destination "Amethyst.Desktop/bin/Release/windows/Plugins" -Recurse | |
| cd Amethyst.Desktop/bin/Release/windows/ | |
| 7z a AME2-$(Get-Date -Format 'yyyyMMdd')-WINDOWS.zip * | |
| - name: Upload artifacts | |
| uses: "marvinpinto/action-automatic-releases@latest" | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: "ame2-latest" | |
| prerelease: true | |
| title: "AME2 Build Artifact" | |
| files: | | |
| ./Amethyst.Desktop/bin/Release/linux/AME2-*-LINUX.zip | |
| ./Amethyst.Desktop/bin/Release/windows/AME2-*-WINDOWS.zip |