Publish To Nuget #19
Workflow file for this run
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: Publish To Nuget | |
on: | |
# pull_request: | |
# push: | |
release: | |
types: [published] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
environment: Default | |
env: | |
NUPKG_MAJOR: 4.0.0 | |
# CODESIGN_PFX: ${{ secrets.CODESIGN_PFX }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup NuGet | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-api-key: ${{ secrets.NuGetAPIKey }} | |
nuget-version: latest | |
# - name: Install MAUI workload | |
# run: dotnet workload install maui | |
# fixes error XA0031: Java SDK 11.0 or above is required when using $(TargetFrameworkVersion) v13.0. [D:\a\UserInteraction\UserInteraction\Vapolia.UserInteraction\Vapolia.UserInteraction.csproj::TargetFramework=MonoAndroid13.0] | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'microsoft' | |
java-version: '17' | |
- name: Build | |
run: dotnet build -c Release Vapolia.UserInteraction\Vapolia.UserInteraction.csproj | |
- name: Package NuGets | |
shell: pwsh | |
run: | | |
$VERSION="$env:NUPKG_MAJOR-ci$env:GITHUB_RUN_ID" | |
if ($env:GITHUB_EVENT_NAME -eq "release") { | |
$VERSION = $env:GITHUB_REF.Substring($env:GITHUB_REF.LastIndexOf('/') + 1) | |
} | |
echo "pkgverci=$VERSION" >> $GITHUB_OUTPUT | |
echo "PACKAGE VERSION: $VERSION" | |
New-Item -ItemType Directory -Force -Path .\artifacts | |
dotnet pack --output ./artifacts -c Release -p:PackageVersion=$VERSION Vapolia.UserInteraction\Vapolia.UserInteraction.csproj | |
#$pfxPath = Join-Path -Path $pwd -ChildPath "codesigncert.pfx" | |
#[IO.File]::WriteAllBytes("$pfxPath", [System.Convert]::FromBase64String($env:CODESIGN_PFX)) | |
#nuget sign .\artifacts\*.nupkg -CertificatePath $pfxPath -Timestamper http://timestamp.entrust.net/TSS/RFC3161sha2TS | |
- name: Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nupkg | |
path: ./artifacts | |
publish: | |
name: Publish | |
needs: build | |
runs-on: windows-latest | |
environment: Default | |
# if: github.event_name == 'release' | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Push to nuget | |
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NuGetAPIKey }} |