diff --git a/.github/workflows/deploy-nuget.yml b/.github/workflows/deploy-nuget.yml new file mode 100644 index 0000000..fd31a79 --- /dev/null +++ b/.github/workflows/deploy-nuget.yml @@ -0,0 +1,103 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + - release/* + +jobs: + build: + env: + BUILD_CONFIG: "Release" + SOLUTION: "FlipView.sln" + PROJECT: "FlipView.csproj" + BUILD_VERSION: "1.0.0" + #TEST_PROJECT: "../Test/Test.csproj" + + runs-on: windows-latest + defaults: + run: + working-directory: ./src + + steps: + - uses: actions/checkout@v2 + + - name: Check branch + run: | + echo commit message: '${{ github.event.head_commit.message }}' + echo Branch: '${{ github.ref }}' + echo Action: '${{ github.event_name }}' + + - name: Check merge commit (only executed if merge is badly formed) + if: startsWith(github.ref, 'refs/heads/main') && (!contains(github.event.head_commit.message, 'Merge pull request ') || !contains(github.event.head_commit.message,'release/')) + run: | + echo INVALID COMMIT RELEASE MESSAGE: '${{ github.event.head_commit.message }}' + exit 1 + + - uses: suisei-cn/actions-download-file@818d6b7dc8fe73f2f924b6241f2b1134ca1377d9 # 1.6.0 + if: startsWith(github.ref, 'refs/heads/main') && contains(github.event.head_commit.message, 'Merge pull request ') && contains(github.event.head_commit.message,'release/') + id: GetBuildVersion # Remember to give an ID if you need the output filename + name: Download GetBuildVersion.psm1 + with: + url: "https://raw.githubusercontent.com/Jon2G/GetBuildVersion/refs/heads/main/GetBuildVersion.psm1" + target: src/ + filename: GetBuildVersion.psm1 + + - name: GetBuildVersion.psm1 + if: startsWith(github.ref, 'refs/heads/main') && contains(github.event.head_commit.message, 'Merge pull request ') && contains(github.event.head_commit.message,'release/') + run: | + $HEAD_COMMIT = "${{github.event.head_commit.message}}" + Import-Module .\GetBuildVersion.psm1 + $version = GetBuildVersion -VersionString $HEAD_COMMIT + echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + echo Version: $version + shell: pwsh + + - name: Setup NuGet + if: startsWith(github.ref, 'refs/heads/main') && contains(github.event.head_commit.message, 'Merge pull request ') && contains(github.event.head_commit.message,'release/') + uses: NuGet/setup-nuget@v2 + + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + 9.0.x + + - name: Install .NET MAUI + run: | + dotnet workload install maui-tizen + dotnet workload install maui-android + + - name: Restore dependencies + run: dotnet restore $SOLUTION + + - name: Build project + run: dotnet build ${{env.PROJECT}} /p:Configuration=${{env.BUILD_CONFIG}} /p:Platform="Any CPU" /p:Version=${{env.BUILD_VERSION}} + + - name: Build solution + run: dotnet build ${{env.SOLUTION}} /p:Configuration=${{env.BUILD_CONFIG}} /p:Platform="Any CPU" /p:Version=${{env.BUILD_VERSION}} + + #- name: Run unit tests with report + # run: dotnet test $TEST_PROJECT --configuration Release --no-build --logger "trx;LogFileName=./../../src/TestResults.trx" + + - name: Show files + run: ls + + # - name: Upload test results + # uses: actions/upload-artifact@v4 + # with: + # name: TestResults + # path: ./TestResults.trx + + - name: Publish package + if: startsWith(github.ref, 'refs/heads/main') && contains(github.event.head_commit.message, 'Merge pull request ') && contains(github.event.head_commit.message,'release/') + run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate + + - name: Publish symbols package + if: startsWith(github.ref, 'refs/heads/main') && contains(github.event.head_commit.message, 'Merge pull request ') && contains(github.event.head_commit.message,'release/') + run: dotnet nuget push **\*.snupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate diff --git a/Test/FlipViewTest/App.xaml.cs b/Test/FlipViewTest/App.xaml.cs index c276a6d..b70e538 100644 --- a/Test/FlipViewTest/App.xaml.cs +++ b/Test/FlipViewTest/App.xaml.cs @@ -1,12 +1,16 @@ -namespace FlipViewTest + +namespace FlipViewTest { public partial class App : Application { public App() { InitializeComponent(); + } - MainPage = new AppShell(); + protected override Window CreateWindow(IActivationState? activationState) + { + return new Window(new AppShell()); } } } diff --git a/Test/FlipViewTest/FlipViewTest.csproj b/Test/FlipViewTest/FlipViewTest.csproj index 817e453..3d6b46c 100644 --- a/Test/FlipViewTest/FlipViewTest.csproj +++ b/Test/FlipViewTest/FlipViewTest.csproj @@ -1,8 +1,8 @@  - net8.0-android;net8.0-ios;net8.0-maccatalyst - $(TargetFrameworks);net8.0-windows10.0.19041.0 + net9.0-android;net9.0-ios;net9.0-maccatalyst + $(TargetFrameworks);net9.0-windows10.0.19041.0 @@ -57,14 +57,13 @@ - - - - + + + - + diff --git a/nuget_icon.png b/nuget_icon.png new file mode 100644 index 0000000..5afd43a Binary files /dev/null and b/nuget_icon.png differ diff --git a/src/FlipView.csproj b/src/FlipView.csproj index 2c0432a..3b5e2d4 100644 --- a/src/FlipView.csproj +++ b/src/FlipView.csproj @@ -1,8 +1,14 @@  - - net8.0;net8.0-maccatalyst;net6.0-android;net7.0-android;net8.0-android;net8.0-ios; - $(TargetFrameworks);net6.0-windows10.0.19041.0;net7.0-windows10.0.19041.0;net8.0-windows10.0.19041.0; + net6.0-android + $(TargetFrameworks);net7.0-android + $(TargetFrameworks);net8.0;net8.0-maccatalyst;net8.0-android;net8.0-ios + $(TargetFrameworks);net9.0;net9.0-maccatalyst;net9.0-android;net9.0-ios + + $(TargetFrameworks);net6.0-windows10.0.19041.0 + $(TargetFrameworks);net7.0-windows10.0.19041.0 + $(TargetFrameworks);net8.0-windows10.0.19041.0 + @@ -37,22 +43,29 @@ Insipired by Expander Control and https://github.com/devcrux/Flip-Animation-in-Xamarin.Forms none - 1.0.5 - --> + 1.0.0 + nuget_icon.png + + + + + True \ + + True + \ + True \ - - - - + + + - diff --git a/FlipView.sln b/src/FlipView.sln similarity index 93% rename from FlipView.sln rename to src/FlipView.sln index 907b8e4..ee6ba98 100644 --- a/FlipView.sln +++ b/src/FlipView.sln @@ -3,17 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlipView", "src\FlipView.csproj", "{800AA4C7-F224-4DEC-8233-E1BFFEC86D85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlipView", "FlipView.csproj", "{800AA4C7-F224-4DEC-8233-E1BFFEC86D85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{F14F8CA8-0B91-466D-8E1B-6E2CA7DA6FA1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlipViewTest", "Test\FlipViewTest\FlipViewTest.csproj", "{0334654D-0993-4613-8EFD-B550B17D852D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E7986880-1ACF-49FA-9342-BE3B84F2E66C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlipViewTest", "..\Test\FlipViewTest\FlipViewTest.csproj", "{0334654D-0993-4613-8EFD-B550B17D852D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7DCA261F-1F0D-4E72-A086-EF50C5B4F90C}" ProjectSection(SolutionItems) = preProject LICENSE = LICENSE + ..\nuget_icon.png = ..\nuget_icon.png README.md = README.md sample.gif = sample.gif EndProjectSection @@ -75,7 +74,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {800AA4C7-F224-4DEC-8233-E1BFFEC86D85} = {E7986880-1ACF-49FA-9342-BE3B84F2E66C} {0334654D-0993-4613-8EFD-B550B17D852D} = {F14F8CA8-0B91-466D-8E1B-6E2CA7DA6FA1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution