Skip to content

Commit

Permalink
refactor: remove Umbraco 10 & 12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdcdev committed Oct 23, 2024
1 parent 17747d6 commit d931440
Show file tree
Hide file tree
Showing 18 changed files with 514 additions and 126 deletions.
14 changes: 4 additions & 10 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# jcdcdev.Umbraco.PackageTemplate

[![Umbraco Version](https://img.shields.io/badge/Umbraco-10.4+-%233544B1?style=flat&logo=umbraco)](https://umbraco.com/products/umbraco-cms/)
[![NuGet](https://img.shields.io/nuget/vpre/jcdcdev.Umbraco.PackageTemplate?color=0273B3)](https://www.nuget.org/packages/jcdcdev.Umbraco.PackageTemplate)
[![GitHub license](https://img.shields.io/github/license/jcdcdev/jcdcdev.Umbraco.PackageTemplate?color=8AB803)](../LICENSE)
[![Downloads](https://img.shields.io/nuget/dt/jcdcdev.Umbraco.PackageTemplate?color=cc9900)](https://www.nuget.org/packages/jcdcdev.Umbraco.PackageTemplate/)
Expand Down Expand Up @@ -49,7 +48,8 @@ An opinionated template for creating Umbraco packages hosted on Github.
Now you can implement your package features.
1. Update `README.md` with your package details
2. Update `umbraco-marketplace.json` with your package details
2. Update `README_nuget.md` with your package details
3. Update `umbraco-marketplace.json` with your package details
### Publish
Expand All @@ -75,17 +75,11 @@ Now you can implement your package features.
## Test Sites
The solution includes a test site for testing your package features against the following Umbraco versions:
- 10.4.0
- 12.0.0
- 13.0.0
Your package project is automatically referenced in each test site.
The solution includes a test site for testing your package features.
### Running Locally
On first boot each test site will:
On first boot the test site will:
- Create a SQLite database
- Create an admin user
Expand Down
21 changes: 0 additions & 21 deletions .github/dependabot.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 🤖 Auto Assign
on:
issues:
types: [opened, edited, labeled, unlabeled]
pull_request:
types: [opened, edited, labeled, unlabeled]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/auto-assign@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
reviewers: |
${{ github.repository_owner }}
assignees: |
${{ github.repository_owner }}
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: Build
on:
pull_request:
branches: "*"

workflow_dispatch:
jobs:
build-package:
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/build-template.yml@main
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Build@main
with:
project-name: 'jcdcdev.Umbraco.PackageTemplate'
project-path: './src/jcdcdev.Umbraco.PackageTemplate.csproj'
dotnet-pack: false
umbraco-version: 13
build:
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/build-template.yml@main
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Build@main
with:
project-name: 'UmbracoPackageTemplate'
project-path: "./src/templates/UmbracoPackageTemplate/src/UmbracoPackageTemplate.sln"
npm-enabled: true
npm-working-dir: "./src/templates/UmbracoPackageTemplate/src/UmbracoPackageTemplate.Client"
npm-run-command: 'build'
npm-run-command: 'build'
umbraco-version: 13
69 changes: 69 additions & 0 deletions .github/workflows/create-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: 📤 Create PRs
on:
workflow_dispatch:
inputs:
dry-run:
description: "Dry run: Run the workflow without creating a Pull Request"
required: false
default: false
type: boolean
schedule:
- cron: '0 2 * * *'
jobs:
get-branches:
outputs:
branches: ${{ steps.get-branches.outputs.branches }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get branches
id: get-branches
shell: pwsh
run: |
$branches = git branch -r --format="%(refname:short)" | ForEach-Object { $_.Trim() -replace "^origin/", "" }
# filter only branches that start with dev/
$branches = $branches | Where-Object { $_ -match "^dev/" }
$branchJson = ConvertTo-Json @($branches) -Compress
Write-Host "branches=$branchJson"
echo "branches=$branchJson" >> $env:GITHUB_OUTPUT
create-pr:
needs: get-branches
strategy:
max-parallel: 1
matrix:
branch: ${{fromJson(needs.get-branches.outputs.branches)}}
runs-on: ubuntu-latest
env:
DRY_RUN: ${{ contains(github.event.inputs.dry-run, 'true') }}
steps:
- name: Set Variables
run: |
TARGET=$(echo ${{ matrix.branch }} | sed 's/dev\///')
SOURCE=${{ matrix.branch }}
if [ -z "$TARGET" ]; then
echo "TARGET is empty"
exit 1
fi
if [ -z "$SOURCE" ]; then
echo "SOURCE is empty"
exit 1
fi
echo "SOURCE=$SOURCE"
echo "TARGET=$TARGET"
echo "SOURCE=$SOURCE" >> $GITHUB_ENV
echo "TARGET=$TARGET" >> $GITHUB_ENV
- name: Create Pull Request
id: create-pull-request
uses: jcdcdev/jcdcdev.GitHub.CreatePullRequest@main
with:
source-branch: ${{ env.SOURCE }}
target-branch: ${{ env.TARGET }}
dry-run: ${{ env.DRY_RUN }}
github-token: ${{ secrets.JCDC_BOT_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ on:
workflow_dispatch:
jobs:
build:
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/build-template.yml@main
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Build@main
with:
project-name: 'jcdcdev.Umbraco.PackageTemplate'
project-path: './src/jcdcdev.Umbraco.PackageTemplate.csproj'
dotnet-pack: false
umbraco-version: 13
release:
needs:
- build
permissions:
contents: write
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/release-template.yml@main
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Release@main
with:
artifact-name: ${{ needs.build.outputs.artifact-name }}
version: ${{ needs.build.outputs.version }}
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/sync-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 🔃 Sync branches

on:
push:
branches:
- 'v*'
workflow_dispatch:

jobs:
check-branch:
runs-on: ubuntu-latest
outputs:
is-valid-branch: ${{ steps.branch_check.outputs.is-valid-branch }}
steps:
- name: Check if branch name starts with 'v'
id: branch_check
run: |
BRANCH_NAME=${{ github.ref }}
if [[ $BRANCH_NAME =~ refs/heads/v.* ]]; then
VALID=true
else
VALID=false
fi
echo "is-valid-branch=$VALID" >> $GITHUB_OUTPUT
merge-branches:
needs: check-branch
permissions:
contents: write
if: needs.check-branch.outputs.is-valid-branch == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Merge into dev/v**
run: |
# Extract the version number from the branch name
VERSION=$(echo "${GITHUB_REF}" | sed -n 's#refs/heads/v\([0-9]\+\)#\1#p')
SOURCE_BRANCH="v${VERSION}"
TARGET_BRANCH="dev/v${VERSION}"
# Set git config
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
echo "Merging $SOURCE_BRANCH into $TARGET_BRANCH"
# Checkout the source branch
git checkout $SOURCE_BRANCH
git pull origin $SOURCE_BRANCH
echo "Pulled latest for $SOURCE_BRANCH"
# Merge into the target branch
git checkout $TARGET_BRANCH
git merge --no-ff $SOURCE_BRANCH -m "Merge v$VERSION into dev/v$VERSION"
echo "Merged $SOURCE_BRANCH into $TARGET_BRANCH"
# Push changes
git push origin $TARGET_BRANCH
echo "Pushed changes to $TARGET_BRANCH"
27 changes: 18 additions & 9 deletions src/jcdcdev.Umbraco.PackageTemplate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageType>Template</PackageType>
<PackageId>jcdcdev.Umbraco.PackageTemplate</PackageId>
<Title>jcdcdev's Umbraco Package Template</Title>
<Authors>James Carter</Authors>
<Authors>jcdcdev</Authors>
<Description>An opinionated Umbraco Package template for Github and NuGet</Description>
<PackageTags>dotnet-new;templates;umbraco</PackageTags>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -21,17 +21,22 @@
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PackageVersion>$([System.DateTime]::UtcNow.ToString(`yyyy`).TrimStart(`0`)).$([System.DateTime]::UtcNow.ToString(`MM`).TrimStart(`0`))$([System.DateTime]::UtcNow.ToString(`dd`).TrimStart(`0`)).$([System.DateTime]::UtcNow.ToString(`Hmm`).TrimStart(`0`))</PackageVersion>
<Major>13</Major>
<Minor>$([System.DateTime]::UtcNow.ToString(`yyyy`))</Minor>
<Patch>$([System.DateTime]::UtcNow.ToString(`MMdd`).TrimStart(`0`))</Patch>
<Suffix>-alpha-$([System.DateTime]::UtcNow.ToString(`Hmm-ss`).TrimStart(`.`))</Suffix>
<PackageVersion>$(Major).$(Minor).$(Patch)$(Suffix)</PackageVersion>
<Version>$(PackageVersion)</Version>
</PropertyGroup>

<ItemGroup>
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**;**\node_modules\**;**\.idea\**"/>
<Content Include="templates\**\*"
Exclude="templates\**\bin\**;templates\**\obj\**;**\node_modules\**;**\.idea\**"/>
<Compile Remove="**\*"/>
<Content Update="templates\UmbracoPackageTemplate\.template.config\template.Release.json">
<TransformOnBuild>false</TransformOnBuild>
<DependentUpon>template.json</DependentUpon>
<IsTransformFile>true</IsTransformFile>
<TransformOnBuild>false</TransformOnBuild>
<DependentUpon>template.json</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</Content>
</ItemGroup>

Expand Down Expand Up @@ -72,11 +77,15 @@
</Target>

<Target Name="ReplacePackageVersion" BeforeTargets="PackTaskDependencies">
<ReplaceTextInFile InputFile="@(ScFilesToTransform->'%(DestinationFile)')" OutputFile="@(ScFilesToTransform->'%(DestinationFile)')" OldValue="#{Version}#" NewValue="$(Version)"/>
<Message Text="Replaced PACKAGE_VERSION with $(Version) in %(TemplateFiles.FullPath)" Importance="high"/>
<ReplaceTextInFile InputFile="@(ScFilesToTransform->'%(DestinationFile)')"
OutputFile="@(ScFilesToTransform->'%(DestinationFile)')" OldValue="#{Version}#"
NewValue="$(Version)"/>
<Message Text="Replaced PACKAGE_VERSION with $(Version) in %(TemplateFiles.FullPath)"
Importance="high"/>
</Target>

<UsingTask TaskName="ReplaceTextInFile" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<UsingTask TaskName="ReplaceTextInFile" TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFile ParameterType="System.String" Required="true"/>
<OutputFile ParameterType="System.String" Required="true"/>
Expand Down
4 changes: 2 additions & 2 deletions src/templates/UmbracoPackageTemplate/.github/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# UmbracoPackageTemplate

[![Umbraco Version](https://img.shields.io/badge/Umbraco-10.4+-%233544B1?style=flat&logo=umbraco)](https://umbraco.com/products/umbraco-cms/)
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/UmbracoPackageTemplate)
[![NuGet](https://img.shields.io/nuget/vpre/UmbracoPackageTemplate?color=0273B3)](https://www.nuget.org/packages/UmbracoPackageTemplate)
[![GitHub license](https://img.shields.io/github/license/TOKEN_GITHUB_USERNAME/UmbracoPackageTemplate?color=8AB803)](../LICENSE)
[![GitHub license](https://img.shields.io/github/license/TOKEN_GITHUB_USERNAME/UmbracoPackageTemplate?color=8AB803)](https://github.com/TOKEN_GITHUB_USERNAME/UmbracoPackageTemplate/blob/TOKEN_UMBRACO_VERSION/LICENSE)
[![Downloads](https://img.shields.io/nuget/dt/UmbracoPackageTemplate?color=cc9900)](https://www.nuget.org/packages/UmbracoPackageTemplate/)

TOKEN_DESCRIPTION
Expand Down
4 changes: 4 additions & 0 deletions src/templates/UmbracoPackageTemplate/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
version: 2
updates:
- package-ecosystem: nuget
assignees:
- "${{ github.repository_owner }}"
directory: "/"
schedule:
interval: "daily"
Expand All @@ -11,6 +13,8 @@ updates:
target-branch: "dev"

- package-ecosystem: npm
assignees:
- "${{ github.repository_owner }}"
directory: "/"
schedule:
interval: "daily"
Expand Down
21 changes: 10 additions & 11 deletions src/templates/UmbracoPackageTemplate/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: 🏗️ Build
on:
pull_request:
branches: "*"
workflow_dispatch:
jobs:
metadata:
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/generate-project-metadata.yml@main
build:
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/build-template.yml@main
needs:
- metadata
with:
project-name: ${{ needs.metadata.outputs.project-name }}
project-path: ${{ needs.metadata.outputs.project-path }}
npm-working-dir: ${{ needs.metadata.outputs.npm-working-dir }}
npm-enabled: true
runs-on: ubuntu-latest
steps:
- name: Build
uses: jcdcdev/jcdcdev.Umbraco.Github.Build@main
with:
project-name: UmbracoPackageTemplate
project-path: src/UmbracoPackageTemplate/UmbracoPackageTemplate.csproj
npm-working-dir: src/UmbracoPackageTemplate.Client
npm-enabled: true
umbraco-version: TOKEN_UMBRACO_VERSION
Loading

0 comments on commit d931440

Please sign in to comment.