Skip to content

Commit

Permalink
Update GitHub Actions for publishing NuGet packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Eilon committed Apr 27, 2023
1 parent a6cbfd0 commit 792259f
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 63 deletions.
65 changes: 29 additions & 36 deletions .github/workflows/CI-MacOS.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Mac Builds
name: Publish NuGet packages (Mac)

on:
# Allows you to run this workflow manually from the Actions tab
Expand All @@ -8,43 +8,36 @@ jobs:
Mac-NuGet-Builds:
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_TOKEN}}
DOTNET_NOLOGO: true

runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build Microcharts.Core
run: |
cd Sources/Microcharts
msbuild -t:build -restore Microcharts.csproj /p:Configuration=Release
- name: Publish Microcharts.Core
run: |
cd NuGet
nuget pack Microcharts.Core.nuspec
nuget push "*.nupkg" -SkipDuplicate -NoSymbols -ApiKey $NUGET_AUTH_TOKEN -Source https://api.nuget.org/v3/index.json
- name: Build Microcharts.Android
run: |
cd Sources/Microcharts.Droid
msbuild -t:build -restore Microcharts.Droid.csproj /p:Configuration=Release
- name: Publish Microcharts.Android
run: |
cd NuGet
nuget pack Microcharts.Android.nuspec
nuget push "*.nupkg" -SkipDuplicate -NoSymbols -ApiKey $NUGET_AUTH_TOKEN -Source https://api.nuget.org/v3/index.json
- name: Build Microcharts.iOS
run: |
cd Sources/Microcharts.iOS
msbuild -t:build -restore Microcharts.iOS.csproj /p:Configuration=Release
- name: Publish Microcharts.iOS
run: |
cd NuGet
nuget pack Microcharts.iOS.nuspec
nuget push "*.nupkg" -SkipDuplicate -NoSymbols -ApiKey $NUGET_AUTH_TOKEN -Source https://api.nuget.org/v3/index.json
- name: Build Microcharts.Mac
run: |
cd Sources/Microcharts.macOS
msbuild -t:build -restore Microcharts.macOS.csproj /p:Configuration=Release
- name: Publish Microcharts.Mac
- name: Clone source
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: "Restore NuGet packages (Mac)"
run: msbuild /t:restore /p:Configuration=Release Sources/Microcharts-mac.slnf /v:diag /bl:mac-build.binlog

- name: "Publish bin logs as artifacts"
uses: actions/upload-artifact@v3
with:
name: msbuild-binlogs
path: '**/*.binlog'
if: always()

- name: "Build and pack Microcharts macOS"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.macOS/Microcharts.macOS.csproj

- name: Publish packages to nuget.org
run: |
cd NuGet
nuget pack Microcharts.Mac.nuspec
cd artifacts
nuget push "*.nupkg" -SkipDuplicate -NoSymbols -ApiKey $NUGET_AUTH_TOKEN -Source https://api.nuget.org/v3/index.json
93 changes: 66 additions & 27 deletions .github/workflows/CI-Windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows Builds
name: Publish NuGet packages (Windows)

on:
# Allows you to run this workflow manually from the Actions tab
Expand All @@ -8,34 +8,73 @@ jobs:
Windows-nuget-Builds:
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_TOKEN}}
DOTNET_NOLOGO: true

runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Build Microcharts.Avalonia
run: |
cd Sources/Microcharts.Avalonia
msbuild -t:build -restore Microcharts.Avalonia.csproj /p:Configuration=Release
- name: Publish Microcharts.Avalonia
run: |
cd NuGet
nuget pack Microcharts.Avalonia.nuspec
nuget push "*.nupkg" -SkipDuplicate -NoSymbols -ApiKey $NUGET_AUTH_TOKEN -Source https://api.nuget.org/v3/index.json
- name: Build Microcharts.Uwp
run: |
cd Sources/Microcharts.Uwp
msbuild -t:build -restore Microcharts.Uwp.csproj /p:Configuration=Release
- name: Publish Microcharts.Uwp
run: |
cd NuGet
nuget pack Microcharts.Uwp.nuspec
nuget push "*.nupkg" -SkipDuplicate -NoSymbols -ApiKey $NUGET_AUTH_TOKEN -Source https://api.nuget.org/v3/index.json
- name: Build Microcharts.Forms
run: |
cd Sources/Microcharts.Forms
msbuild -t:build -restore Microcharts.Forms.csproj /p:Configuration=Release
- name: Publish Microcharts.Forms
- name: Clone source
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0

- name: Add MSBuild to PATH (Windows)
uses: microsoft/setup-msbuild@v1.1.3
if: matrix.os == 'windows-latest'

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: "Restore NuGet packages (Windows)"
run: msbuild /t:restore /p:Configuration=Release Sources/Microcharts.sln /v:diag /bl:win-build.binlog

- name: "Publish bin logs as artifacts"
uses: actions/upload-artifact@v3
with:
name: msbuild-binlogs
path: '**/*.binlog'
if: always()

- name: "Build and pack Microcharts"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts/Microcharts.csproj

- name: "Build and pack Microcharts Android"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Droid/Microcharts.Droid.csproj

- name: "Build and pack Microcharts Xamarin.Forms"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Forms/Microcharts.Forms.csproj

- name: "Build and pack Microcharts iOS"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.iOS/Microcharts.iOS.csproj

- name: "Build and pack Microcharts UWP"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Uwp/Microcharts.Uwp.csproj

- name: "Build and pack Microcharts Avalonia"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Avalonia/Microcharts.Avalonia.csproj

- name: "Build and pack Microcharts Eto"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Eto/Microcharts.Eto.csproj

- name: "Build and pack Microcharts .NET MAUI"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Maui/Microcharts.Maui.csproj

- name: "Build and pack Microcharts Uno"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Uno/Microcharts.Uno.csproj

- name: "Build and pack Microcharts Uno WinUI"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.Uno.WinUI/Microcharts.Uno.WinUI.csproj

- name: "Build and pack Microcharts WinUI"
run: msbuild /t:build,pack /p:Configuration=Release Sources/Microcharts.WinUI/Microcharts.WinUI.csproj

- name: "Build and pack Microcharts Meta-package"
run: dotnet pack Sources/Microcharts.Metapackage/Microcharts.Metapackage.csproj

- name: Publish packages to nuget.org
run: |
cd NuGet
nuget pack Microcharts.Forms.nuspec
cd artifacts
nuget push "*.nupkg" -SkipDuplicate -NoSymbols -ApiKey $NUGET_AUTH_TOKEN -Source https://api.nuget.org/v3/index.json

0 comments on commit 792259f

Please sign in to comment.