Skip to content

Use named pipe to expose callbacks cross-process #4

Use named pipe to expose callbacks cross-process

Use named pipe to expose callbacks cross-process #4

name: NuGet
on:
workflow_dispatch:
inputs:
version:
description: 'Package version (e.g. 1.0.7). Leave empty to use tag version.'
required: false
push:
tags:
- 'v*'
jobs:
publish:
runs-on: windows-latest
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Extract version
id: version
shell: bash
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
TAG="${GITHUB_REF_NAME:-0.0.0-local}"
VERSION="${TAG#v}"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Install native dependencies (x64)
run: vcpkg install --triplet x64-windows-static-md --x-install-root=vcpkg_installed
- name: Install native dependencies (x86)
run: vcpkg install --triplet x86-windows-static-md --x-install-root=vcpkg_installed_x86
- name: Generate version header
shell: pwsh
run: powershell -NoProfile -ExecutionPolicy Bypass -File generate_version.ps1 -Output version_info.h -Version '${{ github.ref_name }}'
- name: Build native DLL (x64)
run: >
msbuild LANCommander.Interposer.slnx
/t:LANCommander_Interposer
/p:Configuration=Release /p:Platform=x64
- name: Build native DLL (x86)
run: >
msbuild LANCommander.Interposer.slnx
/t:LANCommander_Interposer
/p:Configuration=Release /p:Platform=x86
- name: Stage native DLLs for NuGet package
shell: pwsh
run: |
$netDir = 'LANCommander.Interposer.NET'
New-Item -ItemType Directory -Force "$netDir\runtimes\win-x64\native" | Out-Null
New-Item -ItemType Directory -Force "$netDir\runtimes\win-x86\native" | Out-Null
Copy-Item 'Release\Injector\x64\LANCommander.Interposer.dll' "$netDir\runtimes\win-x64\native\"
Copy-Item 'Release\Injector\x86\LANCommander.Interposer.dll' "$netDir\runtimes\win-x86\native\"
- name: Build .NET bindings
run: dotnet build LANCommander.Interposer.NET/LANCommander.Interposer.NET.csproj -c Release -p:Version=${{ steps.version.outputs.version }}
- name: Pack
run: dotnet pack LANCommander.Interposer.NET/LANCommander.Interposer.NET.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o nupkg
- name: Push to NuGet.org
shell: pwsh
run: dotnet nuget push "nupkg\LANCommander.Interposer.${{ steps.version.outputs.version }}.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
# - name: Push to GitHub Packages
# shell: pwsh
# run: dotnet nuget push "nupkg\LANCommander.Interposer.${{ steps.version.outputs.version }}.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate