update tinyexr #11
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: 'Build and publish to NuGet' | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
BUILD_TYPE: Release | |
NuGetDirectory: ${{github.workspace}}/nuget | |
jobs: | |
build-native-win-x64: | |
name: 'Build native win-x64' | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: 'Configure CMake' | |
run: cmake -B ${{github.workspace}}/TinyEXR.Native/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/TinyEXR.Native | |
- name: 'Build' | |
run: cmake --build ${{github.workspace}}/TinyEXR.Native/build --config ${{env.BUILD_TYPE}} | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: TinyEXR.Native.dll | |
if-no-files-found: error | |
path: TinyEXR.Native/build/Release/TinyEXR.Native.dll | |
retention-days: 1 | |
build-native-linux-x64: | |
name: Build native linux-x64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/TinyEXR.Native/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/TinyEXR.Native | |
- name: Build | |
run: cmake --build ${{github.workspace}}/TinyEXR.Native/build --config ${{env.BUILD_TYPE}} | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libTinyEXR.Native.so | |
if-no-files-found: error | |
path: TinyEXR.Native/build/libTinyEXR.Native.so | |
retention-days: 1 | |
build-native-osx-x64: | |
name: Build native osx-x64 | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/TinyEXR.Native/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/TinyEXR.Native | |
- name: Build | |
run: cmake --build ${{github.workspace}}/TinyEXR.Native/build --config ${{env.BUILD_TYPE}} | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libTinyEXR.Native.dylib | |
if-no-files-found: error | |
path: TinyEXR.Native/build/libTinyEXR.Native.dylib | |
retention-days: 1 | |
build-tinyexr-net: | |
name: Build TinyEXR.NET | |
runs-on: windows-latest | |
needs: [build-native-win-x64, build-native-linux-x64, build-native-osx-x64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: TinyEXR.Native.dll | |
path: TinyEXR.NET/Assets/runtimes/win-x64/native | |
- uses: actions/download-artifact@v3 | |
with: | |
name: libTinyEXR.Native.so | |
path: TinyEXR.NET/Assets/runtimes/linux-x64/native | |
- uses: actions/download-artifact@v3 | |
with: | |
name: libTinyEXR.Native.dylib | |
path: TinyEXR.NET/Assets/runtimes/osx-x64/native | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
- name: Build | |
run: dotnet build ${{github.workspace}}/TinyEXR.NET --configuration Release | |
- name: Pack | |
run: dotnet pack ${{github.workspace}}/TinyEXR.NET --configuration Release --output ${{env.NuGetDirectory}} | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nupkg | |
if-no-files-found: error | |
path: ${{env.NuGetDirectory}}/*.nupkg | |
retention-days: 1 | |
publish: | |
name: Publish to nuget | |
runs-on: windows-latest | |
needs: build-tinyexr-net | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
path: ${{env.NuGetDirectory}} | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
- name: Publish NuGet package | |
run: | | |
foreach($file in (Get-ChildItem "${{env.NuGetDirectory}}" -Recurse -Include *.nupkg)) { | |
dotnet nuget push $file --api-key "${{secrets.NUGET_APIKEY}}" --source https://api.nuget.org/v3/index.json --skip-duplicate | |
} | |