Skip to content

Commit

Permalink
config: add kdadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
kselena committed Jun 24, 2024
1 parent 22444ae commit bca922c
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 50 deletions.
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;
3 changes: 3 additions & 0 deletions dev-tools/bin/kd-admin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
# generated by deno install
deno "run" "--allow-read" "--allow-write" "--allow-net" "--allow-env" "--allow-run" "--no-config" "https://raw.githubusercontent.com/KinsonDigital/kd-admin/v1.0.0-preview.3/src/main.ts" "$@"
2 changes: 2 additions & 0 deletions dev-tools/bin/kd-admin.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
% generated by deno install %
@deno "run" "--allow-read" "--allow-write" "--allow-net" "--allow-env" "--allow-run" "--no-config" "https://raw.githubusercontent.com/KinsonDigital/kd-admin/v1.0.0-preview.3/src/main.ts" %*
7 changes: 7 additions & 0 deletions dev-tools/create-pr-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/KinsonDigital/kd-admin/preview/schemas/create-pr-schema.json",
"ownerName": "KinsonDigital",
"repoName": "kd_clients",
"githubTokenEnvVarName": "CICD_TOKEN",
"baseBranches": [ "main", "preview"]
}
38 changes: 38 additions & 0 deletions dev-tools/prepare-release-settings.json
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": "kd_clients",
"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",
"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": "./release-notes",
"releasePrTemplateFilePath": "./templates/prod-prepare-release-template.md",
"releaseLabels": [
"🚀production-release"
],
"prTitle": "🚀Production Release (${VERSION})"
}
],
"githubTokenEnvVarName": "CICD_TOKEN",
"versionFilePath": "./deno.json"
}
60 changes: 60 additions & 0 deletions dev-tools/prev-gen-release-notes-settings.json
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": "kd_clients",
"githubTokenEnvVarName": "CICD_TOKEN",
"milestoneName": "${VERSION}",
"headerText": "${REPONAME} ${RELEASETYPE} 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
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": "kd_clients",
"githubTokenEnvVarName": "CICD_TOKEN",
"milestoneName": "${VERSION}",
"headerText": "${REPONAME} ${RELEASETYPE} 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>

0 comments on commit bca922c

Please sign in to comment.