ci(dotnet): publish nuget packages for all supported environments (#523)

NuGet supports the distribution of native binaries. We already provide a
win-x64 package, this PR adds packages for the other environments. We
will be publishing these NuGet packages:
 - Extism.runtime.linux-arm64
 - Extism.runtime.linux-musl-arm64
 - Extism.runtime.linux-x64
 - Extism.runtime.osx-arm64
 - Extism.runtime.osx-x64
 - Extism.runtime.win-x64 (msvc)
- Extism.runtime.all -> this is a meta package that referencs all other
packages. The idea is, in the getting started guides we instruct the
user to take a dependency on `Extism.Sdk` and `Extism.runtime.all`. This
will make sure their apps work on all supported operating systems
automatically. Otherwise, they can just take a dependency on what they
care about

This PR also adds a dependency on
[MinVer](https://github.com/adamralph/minver) which make sure packages
are automatically versioned based on git tags.

 Related to #486
This commit is contained in:
Muhammad Azeez
2023-10-18 10:47:16 +03:00
committed by GitHub
parent eb05381297
commit 2c82b928ab
13 changed files with 251 additions and 30 deletions

View File

@@ -10,6 +10,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
fetch-tags: true
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3.0.3
with:
@@ -20,10 +22,25 @@ jobs:
name: release-artifacts
- name: Extract Archive
run: |
tar -xvzf libextism-x86_64-pc-windows-msvc-v*.tar.gz --directory dotnet/nuget/runtimes
mv dotnet/nuget/runtimes/extism.dll dotnet/nuget/runtimes/win-x64.dll
- name: Publish win-x64
mkdir -p dotnet/nuget/runtimes/win-x64/native/
tar -xvzf libextism-x86_64-pc-windows-msvc-main.tar.gz -C dotnet/nuget/runtimes/win-x64/native/
mkdir -p dotnet/nuget/runtimes/osx-arm64/native/
tar -xvzf libextism-aarch64-apple-darwin-main.tar.gz -C dotnet/nuget/runtimes/osx-arm64/native/
mkdir -p dotnet/nuget/runtimes/osx-x64/native/
tar -xvzf libextism-x86_64-apple-darwin-main.tar.gz -C dotnet/nuget/runtimes/osx-x64/native/
mkdir -p dotnet/nuget/runtimes/linux-x64/native/
tar -xvzf libextism-x86_64-unknown-linux-gnu-main.tar.gz -C dotnet/nuget/runtimes/linux-x64/native/
mkdir -p dotnet/nuget/runtimes/linux-arm64/native/
tar -xvzf libextism-aarch64-unknown-linux-gnu-main.tar.gz -C dotnet/nuget/runtimes/linux-arm64/native/
mkdir -p dotnet/nuget/runtimes/linux-musl-arm64/native/
tar -xvzf libextism-aarch64-unknown-linux-musl-main.tar.gz -C dotnet/nuget/runtimes/linux-musl-arm64/native/
- name: Publish NuGet packages
run: |
cd dotnet/nuget
dotnet pack -o dist
dotnet nuget push --source https://api.nuget.org/v3/index.json ./dist/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }}
dotnet pack .\dotnet\nuget\Nuget.sln -o release-artifacts
dotnet nuget push --source https://api.nuget.org/v3/index.json ./release-artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }}