Skip to content

Commit

Permalink
Updates package to Umbraco 14
Browse files Browse the repository at this point in the history
  • Loading branch information
skttl committed Aug 8, 2024
1 parent e15e0fa commit e69ddb6
Show file tree
Hide file tree
Showing 19 changed files with 7,000 additions and 145 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ jobs:
- name: Pack
run: dotnet pack ./src/ImageSharpCommunity.Providers.Remote/ImageSharpCommunity.Providers.Remote.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release --no-build
- name: Push to NuGet
run: dotnet nuget push **\ImageSharpCommunity.Providers.Remote.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
- name: Build Umbraco Package
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release
- name: Pack
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release --no-build
- name: Push to NuGet
run: dotnet nuget push **\Umbraco.Community.ImageSharpRemoteImages.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
run: dotnet nuget push **\ImageSharpCommunity.Providers.Remote.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
8 changes: 1 addition & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ jobs:
- name: Pack
run: dotnet pack ./src/ImageSharpCommunity.Providers.Remote/ImageSharpCommunity.Providers.Remote.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release --no-build
- name: Push to NuGet
run: dotnet nuget push **\ImageSharpCommunity.Providers.Remote.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
- name: Build Umbraco Package
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release
- name: Pack
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release --no-build
- name: Push to NuGet
run: dotnet nuget push **\Umbraco.Community.ImageSharpRemoteImages.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
run: dotnet nuget push **\ImageSharpCommunity.Providers.Remote.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
24 changes: 24 additions & 0 deletions .github/workflows/umb-release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release Preview Umbraco Package
on:
push:
tags:
- "umb-v[0-9]+.[0-9]+.[0-9]+-[a-z]*[0-9][0-9][0-9]"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Output version name
run: echo "${VERSION}"
- name: Cancel job if version is empty
if: ${{ env.VERSION == '' }}
run: exit 1
- name: Build Umbraco Package
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release
- name: Pack
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release --no-build
- name: Push to NuGet
run: dotnet nuget push **\Umbraco.Community.ImageSharpRemoteImages.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
24 changes: 24 additions & 0 deletions .github/workflows/umb-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release Umbraco Package
on:
push:
tags:
- "umb-v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Output version name
run: echo "${VERSION}"
- name: Cancel job if version is empty
if: ${{ env.VERSION == '' }}
run: exit 1
- name: Build Umbraco Package
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release
- name: Pack
run: dotnet pack ./src/Umbraco.Community.ImageSharpRemoteImages/Umbraco.Community.ImageSharpRemoteImages.csproj /p:NuGetVersion=${VERSION} /p:Version=${VERSION} --output . --configuration Release --no-build
- name: Push to NuGet
run: dotnet nuget push **\Umbraco.Community.ImageSharpRemoteImages.${VERSION}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Umbraco.Cms.Core.Manifest;
using Umbraco.Cms.Infrastructure.Manifest;

namespace Umbraco.Community.ImageSharpRemoteImages;

public class ImageSharpRemoteImagesManifestReader : IPackageManifestReader
{
public async Task<IEnumerable<PackageManifest>> ReadPackageManifestsAsync()
{
return await Task.Run(() =>
{
return new List<PackageManifest>() {
new PackageManifest()
{
AllowTelemetry = true,
Name = "ImageSharp Remote Images",
Extensions = Array.Empty<object>(),
Version = "14.0.0"
}
};
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/skttl/ImageSharpCommunity.Providers.Remote</RepositoryUrl>
<RootNamespace>ImageSharpCommunity.Providers.Remote</RootNamespace>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Title>Remote Image Provider for ImageSharp.Web in Umbraco</Title>
<Version>0.1.0</Version>
<Version>1.0.0</Version>
</PropertyGroup>

<ItemGroup>
Expand All @@ -37,13 +37,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms.Imaging.ImageSharp" Version="12.0.0" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="12.0.0" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="12.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ImageSharpCommunity.Providers.Remote\ImageSharpCommunity.Providers.Remote.csproj" />
<PackageReference Include="Umbraco.Cms.Imaging.ImageSharp" Version="14.0.0" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="14.0.0" />
<PackageReference Include="ImageSharpCommunity.Providers.Remote" Version="1.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
using ImageSharpCommunity.Providers.Remote.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Infrastructure.Manifest;

namespace Umbraco.Community.ImageSharpRemoteImages;

public static class UmbracoBuilderExtensions
{
public static IUmbracoBuilder AddImageSharpRemoteImages(this IUmbracoBuilder builder, Action<RemoteImageProviderOptions>? defaultOptions = default)
{
// if the Manifest Filter is registred then we assume this has been added before so we don't do it again.
if (builder.ManifestFilters().Has<ImageSharpRemoteImagesManifestFilter>())
{
return builder;
}

// load up the settings.
var options = builder.Services.AddOptions<RemoteImageProviderOptions>()
.Bind(builder.Config.GetSection("Umbraco:Community:ImageSharpRemoteImages"));
Expand All @@ -25,7 +20,7 @@ public static IUmbracoBuilder AddImageSharpRemoteImages(this IUmbracoBuilder bui
}
options.ValidateDataAnnotations();

builder.ManifestFilters().Append<ImageSharpRemoteImagesManifestFilter>();
builder.Services.AddSingleton<IPackageManifestReader, ImageSharpRemoteImagesManifestReader>();

builder.Services.InsertImageProvider<RemoteImageProvider>(0);

Expand Down
42 changes: 25 additions & 17 deletions src/demos/RemoteImageProviderUmbracoDemo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
namespace RemoteImageProviderUmbracoDemo
{
public class Program
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

builder.CreateUmbracoBuilder()
.AddBackOffice()
.AddWebsite()
.AddDeliveryApi()
.AddComposers()
.Build();

WebApplication app = builder.Build();

await app.BootUmbracoAsync();


app.UseUmbraco()
.WithMiddleware(u =>
{
u.UseBackOffice();
u.UseWebsite();
})
.WithEndpoints(u =>
{
public static void Main(string[] args)
=> CreateHostBuilder(args)
.Build()
.Run();
u.UseBackOfficeEndpoints();
u.UseWebsiteEndpoints();
});

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureUmbracoDefaults()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStaticWebAssets();
webBuilder.UseStartup<Startup>();
});
}
}
await app.RunAsync();
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="12.2.0" />
<PackageReference Include="Umbraco.TheStarterKit" Version="12.0.0" />
<PackageReference Include="Umbraco.Cms" Version="14.0.0" />
<PackageReference Include="Umbraco.TheStarterKit" Version="14.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
67 changes: 0 additions & 67 deletions src/demos/RemoteImageProviderUmbracoDemo/Startup.cs

This file was deleted.

10 changes: 3 additions & 7 deletions src/demos/RemoteImageProviderUmbracoDemo/Views/Blog.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
<section class="section">

<div class="container">
@await Umbraco.RenderMacroAsync("latestBlogposts",
new
{
numberOfPosts = Model.HowManyPostsShouldBeShown,
startNodeId = Model.Id
})
@await Component.InvokeAsync("LatestBlogPosts",
new { numberOfPosts = Model.HowManyPostsShouldBeShown, startNodeKey = Model.Key })
</div>

</section>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@using Umbraco.Cms.Core.Models.PublishedContent
@using Umbraco.Extensions
@model Umbraco.SampleSite.Models.LatestBlogPostsViewModel;

<div class="blogposts">
@foreach (IPublishedContent post in Model.BlogPosts)
{
<a href="@post.Url()" class="blogpost">
<div class="blogpost-meta">
<small class="blogpost-date">@post.CreateDate.ToShortDateString()</small>
<small class="blogpost-cat">
@await Html.PartialAsync("~/Views/Partials/CategoryLinks.cshtml", post.Value<IEnumerable<string>>("categories"))
</small>
</div>
<h3 class="blogpost-title">@post.Value("pageTitle")</h3>
<div class="blogpost-excerpt">@post.Value("excerpt")</div>
</a>
}

@if (Model.BlogPosts.Count() < Model.Total)
{
<div class="pagination">
<nav class="nav-bar nav-bar--center">
@if (Model.Page <= 1)
{
<span class="nav-link nav-link--black nav-link--disabled">Prev</span>
}
else
{
<a class="nav-link nav-link--black" href="@(Model.Url + "?page=" + (Model.Page - 1))">Prev</a>
}

@for (int i = 1; i <= Model.PageCount; i++)
{
<a class="nav-link nav-link--black @(Model.Page == i ? " nav-link--active" : null)" href="@(Model.Url + "?page=" + i)">@i</a>
}
@if (Model.Page == Model.PageCount)
{
<span class="nav-link nav-link--black nav-link--disabled">Next</span>
}
else
{
<a class="nav-link nav-link--black" href="@(Model.Url + "?page=" + (Model.Page + 1))">Next</a>
}

</nav>
</div>
}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="blogposts">
<h1>There are no posts at this time, try again later.</h1>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<ContentModels.LatestBlogposts>>;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;

@await Component.InvokeAsync("LatestBlogPosts",
new { numberOfPosts = Model.Content.NumberOfPosts, startNodeKey = Model.Content.StartNode?.Key ?? Guid.Empty })
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
@using Umbraco.Cms.Core.Models.PublishedContent
@using Microsoft.AspNetCore.Html
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Smidge
@inject Smidge.SmidgeHelper SmidgeHelper
Loading

0 comments on commit e69ddb6

Please sign in to comment.