Skip to content

Deploy to NuGet

Deploy to NuGet #2

Workflow file for this run

name: "Deploy to NuGet"
on:
push:
tags:
- "v*"
env:
nuget: "https://api.nuget.org/v3/index.json"
project_name: CsYaz0
authors: ArchLeaders
description: |-
C# bindings for syaz0
readme: ./Readme.md
icon: ./Icon.png
repo: https://github.com/EPD-Libraries/cs-yaz0
spdx: AGPL-3.0-or-later
tags: syaz0;yaz0;zeldamods;botw
jobs:
build:
name: Build Native Assemblies
strategy:
matrix:
config:
- os: ubuntu-latest
lib: Yaz0.so
- os: macos-latest
lib: Yaz0.dylib
- os: windows-latest
lib: Yaz0.dll
runs-on: ${{ matrix.config.os }}
steps:
- name: get-cmake
uses: lukka/[email protected]
- name: Configure CMake
shell: bash
run: |-
cmake --no-warn-unused-cli \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \
-DCMAKE_BUILD_TYPE:STRING=Release \
-S ./native \
-B ./native/build/ \
-G "Ninja" \
- name: Build CMake
shell: bash
run: |-
cmake --build \
./native/build/ \
--config Release \
--target all -j 4 \
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.lib }}
path: ./native/build/${{ matrix.config.lib }}
# Deploy to NuGet
deploy:
needs: build
name: Deploy to NuGet
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get Native Builds
uses: actions/download-artifact@v4
with:
path: ./native/build
pattern: Yaz0*
merge-multiple: true
- name: Check
run: ls -R
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
- name: Restore
shell: bash
run: |-
dotnet restore src/${{ env.project_name }}/${{ env.project_name }}.csproj
- name: Build
shell: bash
run: |-
dotnet build src/${{ env.project_name }}/${{ env.project_name }}.csproj \
--no-restore \
-c Release \
- name: Fetch Version
id: version
uses: battila7/get-version-action@v2
- name: Package
shell: bash
run: |
dotnet pack src/${{ env.project_name }}/${{ env.project_name }}.csproj \
--no-restore \
-c Release \
-o ./build-output/ \
-p:Authors="${{ env.authors }}" \
-p:Description="${{ env.description }}" \
-p:PackageLicenseExpression="${{ env.spdx }}" \
-p:PackageProjectUrl="${{ env.repo }}" \
-p:PackageReadmeFile="${{ env.readme }}" \
-p:PackageIcon="${{ env.icon }}" \
-p:PackageTags='"${{ env.tags }}"' \
-p:PackageVersion="${{ steps.version.outputs.version-without-v }}" \
-p:RepositoryUrl="${{ env.repo }}" \
- name: Push
shell: bash
run: |-
dotnet nuget push ./build-output/*.nupkg \
-k ${{ secrets.NUGET_AUTH }} \
-s ${{ env.nuget }} \