Skip to content

Commit c750db0

Browse files
committed
Standardize public repo, landing page, docs, and release workflow
2 parents 26fc59f + b35d264 commit c750db0

5 files changed

Lines changed: 145 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master, main ]
5+
branches: [ main ]
66
pull_request:
7-
branches: [ master, main ]
7+
branches: [ main ]
88
workflow_dispatch:
99

1010
permissions:

.github/workflows/pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy GitHub Pages
22

33
on:
44
push:
5-
branches: [ master, main ]
5+
branches: [ main ]
66
paths:
77
- 'docs/**'
88
- '.github/workflows/pages.yml'

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,8 @@ Good contribution areas include decoder tests, SCL parsing examples, documentati
171171
Source code is licensed under **Apache-2.0**. See [`LICENSE`](LICENSE).
172172

173173
Npcap is a runtime prerequisite and is not vendored in this repository. Microsoft .NET/WPF runtime files may be included in self-contained published artifacts generated by `dotnet publish`; review [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) before redistributing binary packages.
174+
175+
176+
## Branching policy
177+
178+
This repository uses `main` as the single public development branch. See [Branching policy](docs/BRANCHING.md).

docs/BRANCHING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Branching policy
2+
3+
Process Bus Insight uses a single public development branch:
4+
5+
- `main` — stable public source, documentation, GitHub Pages content, CI, and release automation.
6+
7+
This keeps the repository simple for users who only want to clone, build, download, or inspect the current product state.
8+
9+
## Why one branch?
10+
11+
A public engineering tool should be easy to understand at first glance. A single `main` branch avoids confusion between `master`, feature-hardening branches, temporary release branches, and outdated work-in-progress branches.
12+
13+
## Recommended maintainer workflow
14+
15+
1. Develop changes locally.
16+
2. Push directly to `main` only when the change is clean and buildable.
17+
3. For risky work, use a private/local branch first, then squash or merge into `main` before publishing.
18+
4. Use GitHub Releases for downloadable Windows packages instead of long-lived release branches.
19+
20+
## Automation expectation
21+
22+
The CI, GitHub Pages, and Windows portable release workflows are configured to target `main` only. Tag-based release runs still work for version tags such as `v1.2.3`.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<#
2+
.SYNOPSIS
3+
Standardize this repository to a single public main branch.
4+
5+
.DESCRIPTION
6+
This helper prepares a clean public GitHub repository layout:
7+
- ensures a local main branch exists,
8+
- pushes main to origin,
9+
- sets GitHub default branch to main,
10+
- optionally deletes old remote branches after you confirm they are no longer needed.
11+
12+
The script is intentionally conservative. By default it runs in preview mode.
13+
14+
.EXAMPLE
15+
.\scripts\standardize-main-branch.ps1 -Owner masarray -Repo DigSubAnalyzer -WhatIf
16+
17+
.EXAMPLE
18+
.\scripts\standardize-main-branch.ps1 -Owner masarray -Repo DigSubAnalyzer -Apply
19+
20+
.EXAMPLE
21+
.\scripts\standardize-main-branch.ps1 -Owner masarray -Repo DigSubAnalyzer -Apply -DeleteRemoteBranches master,public-repo-hardening
22+
#>
23+
24+
[CmdletBinding()]
25+
param(
26+
[Parameter(Mandatory = $true)]
27+
[string]$Owner,
28+
29+
[Parameter(Mandatory = $true)]
30+
[string]$Repo,
31+
32+
[string]$TargetBranch = "main",
33+
34+
[string[]]$DeleteRemoteBranches = @(),
35+
36+
[switch]$Apply,
37+
38+
[switch]$WhatIf
39+
)
40+
41+
$ErrorActionPreference = "Stop"
42+
43+
function Invoke-Step {
44+
param(
45+
[Parameter(Mandatory = $true)] [string]$Description,
46+
[Parameter(Mandatory = $true)] [scriptblock]$Command
47+
)
48+
49+
Write-Host "`n==> $Description" -ForegroundColor Cyan
50+
if (-not $Apply -or $WhatIf) {
51+
Write-Host "Preview only. Use -Apply to execute." -ForegroundColor Yellow
52+
return
53+
}
54+
55+
& $Command
56+
}
57+
58+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
59+
throw "Git CLI was not found in PATH. Install Git for Windows first."
60+
}
61+
62+
if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
63+
throw "GitHub CLI was not found in PATH. Install GitHub CLI first."
64+
}
65+
66+
$authStatus = gh auth status 2>&1
67+
if ($LASTEXITCODE -ne 0) {
68+
throw "GitHub CLI is not authenticated. Run: gh auth login"
69+
}
70+
71+
$repoFullName = "$Owner/$Repo"
72+
Write-Host "Repository : $repoFullName"
73+
Write-Host "Target : $TargetBranch"
74+
Write-Host "Apply : $Apply"
75+
Write-Host "Delete : $($DeleteRemoteBranches -join ', ')"
76+
77+
$currentBranch = (git branch --show-current).Trim()
78+
if ([string]::IsNullOrWhiteSpace($currentBranch)) {
79+
throw "No current Git branch detected. Run this script from a normal local checkout."
80+
}
81+
82+
Invoke-Step "Fetch origin" {
83+
git fetch origin --prune
84+
}
85+
86+
Invoke-Step "Create or update local $TargetBranch from current branch '$currentBranch'" {
87+
$existing = git branch --list $TargetBranch
88+
if ($existing) {
89+
git checkout $TargetBranch
90+
git merge $currentBranch --ff-only
91+
} else {
92+
git branch -m $TargetBranch
93+
}
94+
}
95+
96+
Invoke-Step "Push $TargetBranch to origin" {
97+
git push -u origin $TargetBranch
98+
}
99+
100+
Invoke-Step "Set GitHub default branch to $TargetBranch" {
101+
gh repo edit $repoFullName --default-branch $TargetBranch --delete-branch-on-merge=true
102+
}
103+
104+
foreach ($branch in $DeleteRemoteBranches) {
105+
if ($branch -eq $TargetBranch) {
106+
Write-Host "Skipping delete for target branch '$TargetBranch'." -ForegroundColor Yellow
107+
continue
108+
}
109+
110+
Invoke-Step "Delete remote branch origin/$branch" {
111+
git push origin --delete $branch
112+
}
113+
}
114+
115+
Write-Host "`nDone. Expected public branch layout: only '$TargetBranch' remains as the public default branch." -ForegroundColor Green

0 commit comments

Comments
 (0)