Skip to content

[WIP] Audio Device Selection #56

[WIP] Audio Device Selection

[WIP] Audio Device Selection #56

name: VXMusic Desktop Build/Release
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # Add this to manually trigger the workflow
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.x'
- name: Get Project Version
uses: kzrnm/get-net-sdk-project-versions-action@v2
id: get-project-version
with:
proj-path: VXMusicDesktop/VXMusicDesktop.csproj
# - name: Get Last Tag Version
# id: previoustag
# uses: 'WyriHaximus/github-action-get-previous-tag@v1'
# with:
# fallback: ${{ steps.get-project-version.outputs.version }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Determine next version
# id: nextversion
# run: |
# $current_version = '${{ steps.previoustag.outputs.tag }}'
# $base_version = '${{ steps.get-project-version.outputs.version }}'
# if ($current_version -match '(\d+)\.(\d+)\.(\d+)') {
# $major = [int]$matches[1]
# $minor = [int]$matches[2]
# $patch = [int]$matches[3] + 1
# $new_version = "$major.$minor.$patch"
# } else {
# $new_version = "$base_version.0"
# }
# echo "VERSION=$new_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
# shell: pwsh
# - name: Set New Version
# id: set_project_version
# run: |
# $new_version = ${{ steps.get-project-version.outputs.version }}
# echo "Dynamic Version: $new_version"
# echo "new_version=$new_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
# shell: pwsh
# - name: Update CSPROJ with dynamic version
# run: |
# $csproj_path = "VXMusicDesktop/VXMusicDesktop.csproj"
# $new_version = $env:new_version
# (Get-Content $csproj_path) -replace '<Version>.*</Version>', "<Version>$new_version</Version>" | Set-Content $csproj_path
# shell: pwsh
- name: Replace version in NSIS script
run: |
(Get-Content -path "${{ github.workspace }}/Installer/VXMusic.nsi") -replace '(!define PRODUCT_VERSION ").*(")', '!define PRODUCT_VERSION "${{ steps.get-project-version.outputs.version }}"' | Set-Content -path "${{ github.workspace }}/Installer/VXMusic.nsi"
Get-Content -path "${{ github.workspace }}/Installer/VXMusic.nsi"
shell: pwsh
- name: Install dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Publish VXMusic
run: dotnet publish ${{ github.workspace }}/VXMusicDesktop/VXMusicDesktop.csproj -r win-x64 -c Release -o ${{ github.workspace }}/Publish/x64
- name: Make NSIS Installer
id: make_nsis_installer
uses: joncloud/makensis-action@v4.1
with:
script-file: "${{ github.workspace }}/Installer/VXMusic.nsi"
- name: Run VXMusicInstaller
id: run_vxmusicinstaller
if: steps.make_nsis_installer.conclusion == 'success'
run: |
${{ github.workspace }}\Installer\VXMusicInstaller.exe /S /D=${{ github.workspace }}\InstallerOutput
- name: List Installer Output Directory (Debug)
if: steps.run_vxmusicinstaller.conclusion == 'success'
run: |
dir ${{ github.workspace }}\InstallerOutput
- name: Copy Uninstaller to Package Location
if: steps.run_vxmusicinstaller.conclusion == 'success'
id: copy_uninstaller_to_package_location
run: |
Copy-Item -Path ${{ github.workspace }}\InstallerOutput\UninstallVXMusic.exe -Destination ${{ github.workspace }}\Publish\x64
- name: Package VXMusic
run: |
cd ${{ github.workspace }}/Publish/x64
Compress-Archive -Path * -DestinationPath ../../VXMusic_x64_${{ steps.get-project-version.outputs.version }}.zip
shell: pwsh
- name: List Package Output Directory (Debug)
if: steps.copy_uninstaller_to_package_location.conclusion == 'success'
run: |
dir ${{ github.workspace }}\Publish\x64
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get-project-version.outputs.version }}
release_name: VXMusic ${{ steps.get-project-version.outputs.version }}
draft: true
prerelease: false
- name: Upload Installer Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/Installer/VXMusicInstaller.exe
asset_name: VXMusicInstaller_${{ steps.get-project-version.outputs.version }}.exe
asset_content_type: application/octet-stream
- name: Upload 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: ${{ github.workspace }}/VXMusic_x64_${{ steps.get-project-version.outputs.version }}.zip
asset_name: VXMusic_${{ steps.get-project-version.outputs.version }}.zip
asset_content_type: application/zip