From f76f38d2f86a520c257a503ba5b41cf3e7c74138 Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 10 Oct 2024 08:56:35 +0200 Subject: [PATCH 1/6] Create build_publish.yml Created build and publish script for the nuget --- .github/workflows/build_publish.yml | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/build_publish.yml diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml new file mode 100644 index 0000000..bf915ac --- /dev/null +++ b/.github/workflows/build_publish.yml @@ -0,0 +1,61 @@ +# based on: https://github.com/Redth/Maui.ContentButton/blob/main/.github/workflows/build-publish.yml +name: Build and Publish + +on: + pull_request: + push: + branches: [ main ] + release: + types: [published] + +jobs: + build: + name: Build + env: + NUPKG_MAJOR: 0.999 + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + - name: Build + run: dotnet build --configuration Release + - 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 "::set-output name=pkgverci::$VERSION" + echo "PACKAGE VERSION: $VERSION" + + New-Item -ItemType Directory -Force -Path .\artifacts + dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./src/MauiSettings/MauiSettings.csproj + + - name: Artifacts + uses: actions/upload-artifact@v4 + with: + name: NuGet + path: ./artifacts + +# publish: +# name: Publish +# needs: build +# runs-on: windows-latest +# if: github.event_name == 'release' +# steps: +# - name: Download Artifacts +# uses: actions/download-artifact@v4 +# with: +# name: NuGet +# - name: Setup .NET +# uses: actions/setup-dotnet@v3 +# with: +# dotnet-version: '8.0.x' +# - name: Push NuGet +# run: | +# dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} From c565b7397028b6970ecc46e09130879f4191dafd Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 11 Oct 2024 06:43:45 +0200 Subject: [PATCH 2/6] Update build_publish.yml Test to identify issue --- .github/workflows/build_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index bf915ac..c48f39e 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -34,7 +34,7 @@ jobs: echo "PACKAGE VERSION: $VERSION" New-Item -ItemType Directory -Force -Path .\artifacts - dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./src/MauiSettings/MauiSettings.csproj +# dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./src/MauiSettings/MauiSettings.csproj - name: Artifacts uses: actions/upload-artifact@v4 From 6c9c9dd8c004652e5c11d0e6da38325d3d44b6b3 Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 11 Oct 2024 07:05:40 +0200 Subject: [PATCH 3/6] Fixed build issues --- .github/workflows/build_publish.yml | 4 +-- common.props | 13 +++---- framework.maui.props | 35 +++++++++++++++++++ .../MauiSettings.Example.csproj | 32 ++--------------- src/MauiSettings.sln | 1 + src/MauiSettings/MauiSettings.csproj | 16 ++------- 6 files changed, 48 insertions(+), 53 deletions(-) create mode 100644 framework.maui.props diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index c48f39e..ef1698d 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -22,7 +22,7 @@ jobs: with: dotnet-version: 8.0.x - name: Build - run: dotnet build --configuration Release + run: dotnet build --configuration Release ./src - name: Package NuGets shell: pwsh run: | @@ -34,7 +34,7 @@ jobs: echo "PACKAGE VERSION: $VERSION" New-Item -ItemType Directory -Force -Path .\artifacts -# dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./src/MauiSettings/MauiSettings.csproj + dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./src/MauiSettings/MauiSettings.csproj - name: Artifacts uses: actions/upload-artifact@v4 diff --git a/common.props b/common.props index 7d58532..c330fb4 100644 --- a/common.props +++ b/common.props @@ -1,12 +1,7 @@ + - net8.0-android;net8.0-ios;net8.0-maccatalyst - $(TargetFrameworks);net8.0-windows10.0.19041.0 - - - 10.0.19041.41 - 1.0.10 ar_128.png en @@ -20,7 +15,6 @@ Andreas Reitberger Andreas Reitberger 12 - false enable @@ -37,6 +31,9 @@ - + + + + diff --git a/framework.maui.props b/framework.maui.props new file mode 100644 index 0000000..3b30a1b --- /dev/null +++ b/framework.maui.props @@ -0,0 +1,35 @@ + + + + net8.0-android + + $(TargetFrameworks);net8.0-ios;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 + + + + 10.0.19041.41 + + + true + true + enable + false + true + + + true + + 14.2 + 14.0 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + true + + diff --git a/src/MauiSettings.Example/MauiSettings.Example.csproj b/src/MauiSettings.Example/MauiSettings.Example.csproj index 240fff2..4f8ac66 100644 --- a/src/MauiSettings.Example/MauiSettings.Example.csproj +++ b/src/MauiSettings.Example/MauiSettings.Example.csproj @@ -1,24 +1,8 @@  + - net8.0-android;net8.0-ios;net8.0-maccatalyst - $(TargetFrameworks);net8.0-windows10.0.19041.0 - - - 10.0.19041.41 - - - Exe - MauiSettings.Example - true - true - enable - enable - + MauiSettings Example @@ -28,13 +12,6 @@ 1.0 1 - - 11.0 - 13.1 - 21.0 - 10.0.17763.0 - 10.0.17763.0 - 6.5 @@ -56,10 +33,7 @@ - - - - + diff --git a/src/MauiSettings.sln b/src/MauiSettings.sln index bc12285..02e5eef 100644 --- a/src/MauiSettings.sln +++ b/src/MauiSettings.sln @@ -10,6 +10,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3CBCD659-10AB-4B69-B12E-48998DEE148E}" ProjectSection(SolutionItems) = preProject ..\common.props = ..\common.props + ..\framework.maui.props = ..\framework.maui.props nuget.config = nuget.config EndProjectSection EndProject diff --git a/src/MauiSettings/MauiSettings.csproj b/src/MauiSettings/MauiSettings.csproj index 7782a36..297a98c 100644 --- a/src/MauiSettings/MauiSettings.csproj +++ b/src/MauiSettings/MauiSettings.csproj @@ -1,18 +1,8 @@  - true - true - enable - false - enable - - 14.2 - 14.0 - 21.0 - 10.0.17763.0 - 10.0.17763.0 - 6.5 + $(TargetFrameworks);net8.0 + Library AndreasReitberger.Maui A .NET MAUI library to store settings locally and in the cloud @@ -29,8 +19,6 @@ - - From c238b99679d8b458496f1a273cbb302cacb29b56 Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 11 Oct 2024 07:52:06 +0200 Subject: [PATCH 4/6] Avoid `PublishReadyToRun` for libraries --- framework.maui.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework.maui.props b/framework.maui.props index 3b30a1b..28140e6 100644 --- a/framework.maui.props +++ b/framework.maui.props @@ -29,7 +29,7 @@ - + true From c4bb7e8f1d56e42173cac003b0e212613ec879e4 Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 11 Oct 2024 08:06:58 +0200 Subject: [PATCH 5/6] Test with variable version --- .github/workflows/build_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index ef1698d..d3c3bd8 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -26,7 +26,7 @@ jobs: - name: Package NuGets shell: pwsh run: | - $VERSION="$env:NUPKG_MAJOR-ci$env:GITHUB_RUN_ID" + $VERSION="$env:NUPKG_VERSION-ci$env:GITHUB_RUN_ID" if ($env:GITHUB_EVENT_NAME -eq "release") { $VERSION = $env:GITHUB_REF.Substring($env:GITHUB_REF.LastIndexOf('/') + 1) } From d38ea374bf6fb7c08c670a076646e4a1ebd793cd Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 11 Oct 2024 08:18:53 +0200 Subject: [PATCH 6/6] Update build_publish.yml --- .github/workflows/build_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index d3c3bd8..ef1698d 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -26,7 +26,7 @@ jobs: - name: Package NuGets shell: pwsh run: | - $VERSION="$env:NUPKG_VERSION-ci$env:GITHUB_RUN_ID" + $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) }