Build and publish AutoDiscovery in this repository too #14
Workflow file for this run
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: Redpoint.Logging.Mac.Native | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
UET_FRAMEWORK_TARGET: net8.0 | |
UET_BUILDING_ON_BUILD_SERVER: "true" | |
jobs: | |
mac-logging: | |
name: "Build and Publish" | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET SDK | |
uses: ./.github/actions/dotnet-sdk | |
with: | |
UET_FRAMEWORK_TARGET: ${{ env.UET_FRAMEWORK_TARGET }} | |
- name: Build Redpoint.Logging.Mac.Native | |
shell: pwsh | |
run: | | |
$Timestamp = ([DateTime]::UtcNow) | |
$PackageVersion = "$($Timestamp.Year).$($Timestamp.DayOfYear + 1000).$(($Timestamp.Hour * 60) + $Timestamp.Minute)" | |
Write-Host "Package version: $PackageVersion" | |
Write-Host "Installing Mono..." | |
/opt/homebrew/bin/brew install mono | |
if ($LastExitCode -ne 0) { exit $LastExitCode } | |
Push-Location "Redpoint.Logging.Mac.Native" | |
Write-Host "Building native logging libraries for macOS..." | |
New-Item -ItemType Directory -Path ./runtimes/osx-arm64/native/ | Out-Null | |
clang -dynamiclib -o "./runtimes/osx-arm64/native/libLogging.arm64.dylib" -arch arm64 "logging.c" | |
if ($LastExitCode -ne 0) { exit $LastExitCode } | |
New-Item -ItemType Directory -Path ./runtimes/osx-x64/native/ | Out-Null | |
clang -dynamiclib -o "./runtimes/osx-x64/native/libLogging.x64.dylib" -arch x86_64 "logging.c" | |
if ($LastExitCode -ne 0) { exit $LastExitCode } | |
Write-Host "Generating NuGet package..." | |
Invoke-WebRequest -UseBasicParsing -OutFile nuget.exe -Uri "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" | |
/opt/homebrew/bin/mono nuget.exe pack Redpoint.Logging.Mac.Native.nuspec -Version $PackageVersion -OutputDirectory bin | |
if ($LastExitCode -ne 0) { exit $LastExitCode } | |
- name: Publish Redpoint.Logging.Mac.Native | |
shell: pwsh | |
if: github.ref == 'refs/heads/main' | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: | | |
dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key $env:NUGET_API_KEY (Get-ChildItem -Recurse -Filter "bin/Redpoint.Logging.Mac.Native.*.nupkg" | % { $_.FullName }) | |
if ($LastExitCode -ne 0) { exit $LastExitCode } |