Skip to content

NuGet

NuGet #363

Workflow file for this run

name: NuGet
on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'
schedule:
- cron: '0 0 * * 6'
workflow_dispatch:
jobs:
nuget-push:
runs-on: 'windows-2022'
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read version from ref
id: version
shell: pwsh
run: echo "version=$(./scripts/Get-Version.ps1 -RefName $env:GITHUB_REF)" >> $env:GITHUB_OUTPUT
- name: NuGet cache
uses: actions/cache@v3
with:
path: ${{ env.NUGET_PACKAGES }}
key: release.nuget.${{ hashFiles('**/*.csproj', '**/*.fsproj') }}
- name: Set up .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Prepare a NuGet package
run: dotnet pack XamlMath.All.sln --configuration Release -p:Version=${{ steps.version.outputs.version }}
- name: Read changelog
id: changelog
uses: ForNeVeR/ChangelogAutomation.action@v1
with:
output: ./release-notes.md
- name: 'Upload workflow artifacts'
uses: 'actions/upload-artifact@v3'
with:
name: 'XAML-Math v${{ steps.version.outputs.version }}'
path: |
./release-notes.md
./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.nupkg
./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.snupkg
./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.nupkg
./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.snupkg
./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg
./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.snupkg
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: XAML-Math v${{ steps.version.outputs.version }}
body_path: ./release-notes.md
- name: Upload Avalonia-Math .nupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: AvaloniaMath.${{ steps.version.outputs.version }}.nupkg
asset_path: ./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.nupkg
asset_content_type: application/zip
- name: Upload WPF-Math .nupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: WpfMath.${{ steps.version.outputs.version }}.nupkg
asset_path: ./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.nupkg
asset_content_type: application/zip
- name: Upload XAML-Math .nupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg
asset_path: ./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg
asset_content_type: application/zip
- name: Upload Avalonia-Math .snupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: AvaloniaMath.${{ steps.version.outputs.version }}.snupkg
asset_path: ./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.snupkg
asset_content_type: application/zip
- name: Upload WPF-Math .snupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: WpfMath.${{ steps.version.outputs.version }}.snupkg
asset_path: ./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.snupkg
asset_content_type: application/zip
- name: Upload XAML-Math .snupkg file
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: XamlMath.Shared.${{ steps.version.outputs.version }}.snupkg
asset_path: ./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.snupkg
asset_content_type: application/zip
- name: Push Avalonia-Math package to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/AvaloniaMath/bin/Release/AvaloniaMath.${{ steps.version.outputs.version }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}
- name: Push WPF-Math package to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/WpfMath/bin/Release/WpfMath.${{ steps.version.outputs.version }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}
- name: Push XAML-Math package to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/XamlMath.Shared/bin/Release/XamlMath.Shared.${{ steps.version.outputs.version }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}