Skip to content

Commit

Permalink
update nugets and ci workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
softlion committed Apr 19, 2024
1 parent ffcd51f commit c4f832f
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 56 deletions.
62 changes: 17 additions & 45 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
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:
Expand All @@ -15,68 +12,43 @@ jobs:
environment: Default
env:
NUPKG_MAJOR: 4.0.0
# CODESIGN_PFX: ${{ secrets.CODESIGN_PFX }}
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
PROJECT: Vapolia.UserInteraction\Vapolia.UserInteraction.csproj

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
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
shell: pwsh
run: dotnet build -c Release $env:PROJECT

- name: Package NuGets
shell: pwsh
env:
#required so if it contains special characters they are not interpreted by powershell
NUGET_AUTH_TOKEN: ${{secrets.NUGETAPIKEY}}
NUGET_TARGET: https://api.nuget.org/v3/index.json
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 }}
dotnet pack --no-build --output ./artifacts -c Release -p:PackageVersion=$VERSION $env:PROJECT
# needs to CD because nuget push can't find nuget packages with a linux style path
cd ./artifacts
dotnet nuget push *.nupkg --skip-duplicate -k $env:NUGET_AUTH_TOKEN -s $env:NUGET_TARGET
2 changes: 1 addition & 1 deletion FormsDemo/FormsDemo.Droid/FormsDemo.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2612" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2662" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down
2 changes: 1 addition & 1 deletion FormsDemo/FormsDemo.iOS/FormsDemo.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2612" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2662" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FormsDemo\FormsDemo.csproj">
Expand Down
2 changes: 1 addition & 1 deletion FormsDemo/FormsDemo/FormsDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2612" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2662" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MauiDemo/MauiDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.10" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.20" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions Vapolia.UserInteraction.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDemo.iOS", "FormsDemo\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Forms", "Forms", "{7D2CBFBA-85A3-40C4-9689-D3EE0FFCAD22}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{7A7A83A1-80F9-42F4-9343-A262A8E4FE3E}"
ProjectSection(SolutionItems) = preProject
.github\workflows\main.yaml = .github\workflows\main.yaml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
20 changes: 13 additions & 7 deletions Vapolia.UserInteraction/Vapolia.UserInteraction.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
<Compile Include="**\*.netstandard.cs" />
<Compile Include="**\*.netstandard.*.cs" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) or $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
Expand Down Expand Up @@ -54,25 +54,31 @@
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS'))">
<PackageReference Include="Cirrious.FluentLayout" Version="3.0.0" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2622" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2622" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.9.0.3" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.8.0.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net8.0'))">
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.10" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.20" />
</ItemGroup>

<ItemGroup>
<None Include="../LICENSE" Pack="true" PackagePath="" />
<None Include="../README.MD" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'MonoAndroid13.0'">
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2662" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'Xamarin.iOS10'">
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2662" />
</ItemGroup>

<!-- nuget configurable properties -->
<PropertyGroup>
<Version>0.0.0-pre1</Version>
Expand Down

0 comments on commit c4f832f

Please sign in to comment.