Build and Release #27
This file contains 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: Build and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Release tag(e.g., v1.2.3) without starting 'v'" | |
required: true | |
type: string | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: "6.7.2" | |
add-tools-to-path: true | |
cache: true | |
- name: Setup MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Build | |
run: | | |
mkdir build | |
cd build | |
qmake ../ | |
nmake | |
- name: Remove source and object files | |
shell: pwsh | |
run: | | |
$buildDir = "build/release" | |
if (Test-Path $buildDir) { | |
Get-ChildItem -Path $buildDir -Include *.cpp, *.h, *.obj, *.res, *.qrc, *.qm -Recurse | Remove-Item -Force | |
} else { | |
Write-Host "Directory not found: $buildDir" | |
} | |
- name: Deploy Qt | |
shell: pwsh | |
run: | | |
cd build | |
$windeployqtPath = "D:\a\HeadsetControl-GUI\Qt\6.7.2\msvc2019_64\bin\windeployqt6.exe" | |
if (Test-Path $windeployqtPath) { | |
& $windeployqtPath ` | |
--exclude-plugins qsvgicon,qsvg,qico,qjpeg,qgif,qnetworklistmanager,qtuiotouchplugin ` | |
--no-opengl-sw ` | |
--no-system-dxc-compiler ` | |
--no-compiler-runtime ` | |
--no-translations ` | |
--no-system-d3d-compiler ` | |
D:\a\HeadsetControl-GUI\HeadsetControl-GUI\build\release\HeadsetControl-GUI.exe | |
} else { | |
Write-Error "windeploygui not found at the expected path!" | |
exit 1 | |
} | |
- name: Download ZIP from other repo | |
shell: pwsh | |
run: | | |
Invoke-WebRequest -Uri "https://github.com/Sapd/HeadsetControl/releases/latest/download/headsetcontrol-windows.zip" -OutFile headsetcontrol-windows.zip | |
Expand-Archive -Path headsetcontrol-windows.zip -DestinationPath build/release/ | |
- name: Zip binaries folder | |
run: | | |
$zipFile = "HeadsetControl-GUI_windows_64.zip" | |
$folder = "build/release/*" | |
Compress-Archive -Path $folder -DestinationPath $zipFile | |
shell: pwsh | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HeadsetControl-GUI_windows_64 | |
path: HeadsetControl-GUI_windows_64.zip | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: "6.7.2" | |
host: "linux" | |
add-tools-to-path: true | |
cache: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential libgl1-mesa-dev | |
- name: Build with qmake | |
run: | | |
mkdir build | |
cd build | |
qmake ../HeadsetControl-GUI.pro CONFIG+=release | |
make -j$(nproc) | |
- name: Zip binaries folder | |
run: | | |
zip -r HeadsetControl-GUI_linux_64.zip build/HeadsetControl-GUI | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HeadsetControl-GUI_linux_64 | |
path: HeadsetControl-GUI_linux_64.zip | |
create-release: | |
needs: [build-linux, build-windows] | |
runs-on: ubuntu-latest | |
if: false | |
steps: | |
- name: Download Linux artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: HeadsetControl-GUI_linux_64 | |
- name: Download Windows artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: HeadsetControl-GUI_windows_64 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ inputs.version }} | |
release_name: Release v${{ inputs.version }} | |
body: | | |
## Contributor | |
@nicola02nb Mantainer | |
## Credits | |
@Sapd for [HeadsetControl](https://github.com/Sapd/HeadsetControl) | |
draft: false | |
prerelease: false | |
- name: Upload Linux Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./HeadsetControl-GUI_linux_64.zip | |
asset_name: HeadsetControl-GUI_linux_64.zip | |
asset_content_type: application/octet-stream | |
- name: Upload Windows Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./HeadsetControl-GUI_windows_64.zip | |
asset_name: HeadsetControl-GUI_windows_64.zip | |
asset_content_type: application/octet-stream | |
winget-release: | |
needs: [create-release] | |
runs-on: windows-latest | |
#if: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Winget-Create | |
run: | | |
winget install wingetcreate | |
- name: Update manifest | |
env: | |
VERSION: ${{ inputs.version }} | |
run: | | |
wingetcreate update --version $env:VERSION --urls https://github.com/LeoKlaus/HeadsetControl-GUI/releases/latest/download/HeadsetControl-GUI_windows_64.zip LeoKlaus.HeadsetControl-GUI | |
winget validate .\LeoKlaus.HeadsetControl-GUI.yaml | |
- name: Validate manifest | |
env: | |
VERSION: ${{ inputs.version }} | |
run: | | |
winget validate --manifest manifests\l\LeoKlaus\HeadsetControl-GUI\$env:VERSION\ | |
- name: Submit manifest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ inputs.version }} | |
run: | | |
ls |