Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧Set up KD-Admin #357

Merged
merged 10 commits into from
Jun 26, 2024
Merged
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"pwsh",
"Reactable",
"reactables",
"REPONAME",
"runsettings",
"simpleinjector",
"softprops",
Expand Down
2 changes: 2 additions & 0 deletions CASL.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OSX/@EntryIndexedValue">OSX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RTLD/@EntryIndexedValue">RTLD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=904C8A5003B50746A7EABA48B8FAEC82/@KeyIndexDefined">True</s:Boolean>
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=904C8A5003B50746A7EABA48B8FAEC82/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=904C8A5003B50746A7EABA48B8FAEC82/Description/@EntryValue">XUnit Unit Test Method</s:String>
Expand Down
51 changes: 1 addition & 50 deletions create-pr.ps1
Original file line number Diff line number Diff line change
@@ -1,50 +1 @@
Clear-Host;

Write-Host -NoNewline "Please enter an issue number: " -ForegroundColor Cyan;
$issueNumber = Read-Host;

if ($issueNumber -notmatch '^\d+$') {
Write-Error "User input is not a number";
exit 1;
}

Write-Host -NoNewline "Please enter a branch name: " -ForegroundColor Cyan;
$branchDescrip = Read-Host;

$branchDescrip = $branchDescrip.ToLower();
$branchDescrip = $branchDescrip.Replace(" ", "-").Replace("_", "-");
$branchDescrip = $branchDescrip.TrimStart("-");
$branchDescrip = $branchDescrip.TrimEnd("-");

$headBranch = "feature/$issueNumber-$branchDescrip";
$commitMsg = "Start work for issue #$issueNumber";

$destBranch = "not-set";

$baseBranches = @("main", "preview");
Write-Host -NoNewline "Please choose a base branch from the list [$($baseBranches -join ', ')]: " -ForegroundColor Cyan;
$chosenBaseBranch = Read-Host;

if ($baseBranches -contains $chosenBaseBranch) {
$destBranch = $chosenBaseBranch;
} else {
Write-Error "Invalid base branch.";
exit 1;
}

Write-Host "`n--------------------------------`n";

Write-Host "Creating branch. . ." -ForegroundColor Yellow;
git checkout -B "$headBranch";
Write-Host "";

Write-Host "Creating empty commit. . ." -ForegroundColor Yellow;
git commit --allow-empty -m $commitMsg;
Write-Host "";

Write-Host "Pushing branch to remote. . ." -ForegroundColor Yellow;
git push --set-upstream origin "$headBranch";
Write-Host "";

Write-Host "Creating PR. . ." -ForegroundColor Yellow;
gh pr create -B $destBranch -b "" -t "new pr" -d;
& "dev-tools/bin/kd-admin" create-pr;
10 changes: 10 additions & 0 deletions dev-tools/create-pr-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://raw.githubusercontent.com/KinsonDigital/kd-admin/preview/schemas/create-pr-schema.json",
"ownerName": "KinsonDigital",
"repoName": "CASL",
"githubTokenEnvVarName": "CICD_TOKEN",
"baseBranches": [
"main",
"preview"
]
}
38 changes: 38 additions & 0 deletions dev-tools/prepare-release-settings.json
CalvinWilkinson marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://raw.githubusercontent.com/KinsonDigital/kd-admin/preview/schemas/prepare-release-schema.json",
"ownerName": "KinsonDigital",
"repoName": "CASL",
"orgProjectName": "KD-Team",
"releaseTypes": [
{
"name": "Preview",
"reviewer": "KinsonDigitalAdmin",
"assignee": "CalvinWilkinson",
"headBranch": "prev-release",
"baseBranch": "preview",
"genReleaseSettingsFilePath": "./dev-tools/prev-gen-release-notes-settings.json",
"releaseNotesDirPath": "./ReleaseNotes/PreviewReleases",
"releasePrTemplateFilePath": "./templates/prev-prepare-release-template.md",
"releaseLabels": [
"🚀preview-release"
],
"prTitle": "🚀Preview Release (${VERSION})"
},
{
"name": "Production",
"reviewer": "KinsonDigitalAdmin",
"assignee": "CalvinWilkinson",
"headBranch": "prod-release",
"baseBranch": "main",
"genReleaseSettingsFilePath": "./dev-tools/prod-gen-release-notes-settings.json",
"releaseNotesDirPath": "./ReleaseNotes/ProductionReleases",
"releasePrTemplateFilePath": "./templates/prod-prepare-release-template.md",
"releaseLabels": [
"🚀production-release"
],
"prTitle": "🚀Production Release (${VERSION})"
}
],
"githubTokenEnvVarName": "CICD_TOKEN",
"versionFilePath": "./CASL/CASL.csproj"
}
60 changes: 60 additions & 0 deletions dev-tools/prev-gen-release-notes-settings.json
CalvinWilkinson marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://raw.githubusercontent.com/KinsonDigital/kd-admin/preview/schemas/gen-release-notes-schema.json",
"ownerName": "KinsonDigital",
"repoName": "CASL",
"githubTokenEnvVarName": "CICD_TOKEN",
"milestoneName": "${VERSION}",
"headerText": "${REPONAME} Preview Release Notes - ${VERSION}",
"releaseType": "Preview",
"extraInfo": {
"title": "Quick Reminder",
"text": "As with all software, there is always a chance for issues and bugs, especially for preview releases, so your input is greatly appreciated. 🙏🏼"
},
"emojisToRemoveFromTitle": [
"🚧",
"🐛",
"✨",
"🚀",
"🧪",
"🔬"
],
"issueCategoryLabelMappings": {
"New Features ✨": "✨new-feature",
"Enhancements 💎": "💎enhancement",
"Bug Fixes 🐛": "🐛bug",
"Breaking Changes 🧨": "🧨breaking-changes",
"Dependency Updates 📦": "📦dependency-update"
},
"prCategoryLabelMappings": {
"Dependency Updates 📦": "📦dependency-update"
},
"ignoreLabels": [
"🚀preview-release"
],
"wordReplacements": {
"chore(deps): ": ""
},
"firstWordReplacements": {
"Add": "Added",
"Improve": "Improved",
"Fix": "Fixed",
"Update": "Updated",
"Upgrade": "Upgraded",
"Create": "Created",
"Refactor": "Refactored",
"Removed": "Removed",
"Implement": "Implemented",
"Move": "Moved",
"Change": "Changed",
"Increase": "Increased",
"Prevent": "Prevented",
"Introduce": "Introduced",
"Adjust": "Adjusted",
"Replace": "Replaced",
"Deprecate": "Deprecated",
"Integrate": "Integrated"
},
"boldedVersions": true,
"italicVersions": true,
"otherCategoryName": "Other 🪧"
}
56 changes: 56 additions & 0 deletions dev-tools/prod-gen-release-notes-settings.json
CalvinWilkinson marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "https://raw.githubusercontent.com/KinsonDigital/kd-admin/preview/schemas/gen-release-notes-schema.json",
"ownerName": "KinsonDigital",
"repoName": "CASL",
"githubTokenEnvVarName": "CICD_TOKEN",
"milestoneName": "${VERSION}",
"headerText": "${REPONAME} Production Release Notes - ${VERSION}",
"releaseType": "Production",
"emojisToRemoveFromTitle": [
"🚧",
"🐛",
"✨",
"🚀",
"🧪",
"🔬"
],
"issueCategoryLabelMappings": {
"New Features ✨": "✨new-feature",
"Enhancements 💎": "💎enhancement",
"Bug Fixes 🐛": "🐛bug",
"Breaking Changes 🧨": "🧨breaking-changes",
"Dependency Updates 📦": "📦dependency-update"
},
"prCategoryLabelMappings": {
"Dependency Updates 📦": "📦dependency-update"
},
"ignoreLabels": [
"🚀production-release"
],
"wordReplacements": {
"chore(deps): ": ""
},
"firstWordReplacements": {
"Add": "Added",
"Improve": "Improved",
"Fix": "Fixed",
"Update": "Updated",
"Upgrade": "Upgraded",
"Create": "Created",
"Refactor": "Refactored",
"Removed": "Removed",
"Implement": "Implemented",
"Move": "Moved",
"Change": "Changed",
"Increase": "Increased",
"Prevent": "Prevented",
"Introduce": "Introduced",
"Adjust": "Adjusted",
"Replace": "Replaced",
"Deprecate": "Deprecated",
"Integrate": "Integrated"
},
"boldedVersions": true,
"italicVersions": true,
"otherCategoryName": "Other 🪧"
}
1 change: 1 addition & 0 deletions prepare-for-release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
& "dev-tools/bin/kd-admin" prepare-for-release;
25 changes: 25 additions & 0 deletions templates/prev-prepare-release-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### Pre-Release ToDo List
```[tasklist]
- [ ] All issues in the assigned milestone are closed, and all issue tasks are complete.
- [ ] Add _**`🚀preview-release`**_ label to this pull request.
- [ ] The pull request is assigned to a project.
- [ ] The pull request is assigned to a milestone.
- [ ] All unit tests have been executed locally and have passed. _(Check out the appropriate release branch before running tests)_.
- [ ] Auto-generated release notes have been reviewed and updated if necessary.
- [ ] Manual QA Testing completed _(if applicable)_.
- [ ] Release to **_preview_** completed. _(The release is performed by running the `🚀Release` workflow)_.
```

### Post-Release ToDo List
```[tasklist]
- [ ] The GitHub release has been created and is correct.
```

### Additional Information:

**_<details closed><summary>Unit Tests</summary>_**

Reasons for local unit test execution:
- Unit tests might pass locally but not in the CI environment during the status check process or vice-versa.
- Tests might pass on the developer's machine but not necessarily on the code reviewer's machine.
</details>
25 changes: 25 additions & 0 deletions templates/prod-prepare-release-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### Pre-Release ToDo List
```[tasklist]
- [ ] All issues in the assigned milestone are closed, and all issue tasks are complete.
- [ ] Add _**`🚀production-release`**_ label to this pull request.
- [ ] The pull request is assigned to a project.
- [ ] The pull request is assigned to a milestone.
- [ ] All unit tests have been executed locally and have passed. _(Check out the appropriate release branch before running tests)_.
- [ ] Auto-generated release notes have been reviewed and updated if necessary.
- [ ] Manual QA Testing completed _(if applicable)_.
- [ ] Release to **_production_** completed. _(The release is performed by running the `🚀Release` workflow)_.
```

### Post-Release ToDo List
```[tasklist]
- [ ] The GitHub release has been created and is correct.
```

### Additional Information:

**_<details closed><summary>Unit Tests</summary>_**

Reasons for local unit test execution:
- Unit tests might pass locally but not in the CI environment during the status check process or vice-versa.
- Tests might pass on the developer's machine but not necessarily on the code reviewer's machine.
</details>
Loading