on:
  workflow_dispatch:

name: Release .NET Native NuGet Packages

jobs:
  release-runtimes:
    name: release-dotnet-native
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup .NET Core SDK
        uses: actions/setup-dotnet@v3.0.3
        with:
           dotnet-version: 7.x
      - uses: dawidd6/action-download-artifact@v2
        with:
          workflow: release.yml
          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
        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 }}