Skip to content

Build & push .NET library #38

Build & push .NET library

Build & push .NET library #38

name: Build & push .NET library
on:
# Triggers the workflow on push for the master branch
#push:
# branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
PROJECT_FILE: "src/libraries/Highbyte.DotNet6502/Highbyte.DotNet6502.csproj"
# PROJECT_FILE2: "src/libraries/Highbyte.DotNet6502.Systems/Highbyte.DotNet6502.Systems.csproj"
# PROJECT_FILE3: "src/libraries/Highbyte.DotNet6502.Monitor/Highbyte.DotNet6502.Monitor.csproj"
# PROJECT_FILE4: "src/libraries/Highbyte.DotNet6502.Impl.SadConsole/Highbyte.DotNet6502.Impl.SadConsole.csproj"
# PROJECT_FILE5: "src/libraries/Highbyte.DotNet6502.Impl.AspNet/Highbyte.DotNet6502.Impl.AspNet.csproj"
# PROJECT_FILE6: "src/libraries/Highbyte.DotNet6502.Impl.SilkNet/Highbyte.DotNet6502.Impl.SilkNet.csproj"
# PROJECT_FILE7: "src/libraries/Highbyte.DotNet6502.Impl.Skia/Highbyte.DotNet6502.Impl.Skia.csproj"
CONFIGURATION: "Release"
VERSION: "0.13.0" #Major.Minor[.Rev]
VERSION_SUFFIX: "-alpha"
PACKAGE_REPO: "https://nuget.pkg.github.com/highbyte/index.json"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
# - name: Clean package cache as a temporary workaround for actions/setup-dotnet#155
# run: |
# dotnet clean
# dotnet nuget locals all --clear
- name: Build dll
run: dotnet build ${{ env.PROJECT_FILE }} -c ${{ env.CONFIGURATION }} /Property:Version=${{ env.VERSION }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}
- name: Pack NuGet package
run: dotnet pack ${{ env.PROJECT_FILE }} --no-build -c ${{ env.CONFIGURATION }} -p:PackageVersion=${{ env.VERSION }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }} -o out
- name: Push NuGet package to GitHub Packages
run: dotnet nuget push "./out/*.nupkg" --source ${{ env.PACKAGE_REPO }} --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
- name: Push NuGet package to NuGet.org
run: dotnet nuget push "./out/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
# - name: Build dll 2
# run: dotnet build ${{ env.PROJECT_FILE2 }} -c ${{ env.CONFIGURATION }} /Property:Version=${{ env.VERSION }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}
# - name: Pack NuGet package 2
# run: dotnet pack ${{ env.PROJECT_FILE2 }} --no-build -c ${{ env.CONFIGURATION }} -p:PackageVersion=${{ env.VERSION }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }} -o out2
# - name: Push NuGet package 2 to GitHub Packages
# run: dotnet nuget push "./out2/*.nupkg" --source ${{ env.PACKAGE_REPO }} --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
# - name: Push NuGet package 2 to NuGet.org
# run: dotnet nuget push "./out2/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate