Files
netswitch/CONTRIBUTING.md
T
engel 876b2c72bc chore: cut GitHub, make netswitch Gitea-only
- relink README/CHANGELOG/pyproject/SECURITY to git.engelgardt23.ru
- update-check + badges point to Gitea; rename GITHUB_REPO -> REPO
- port CI to .gitea/workflows (self-contained, publishes Gitea release)
- remove .github (workflow + issue templates); drop made-by lines
2026-06-01 12:58:03 +03:00

2.2 KiB

Contributing

Project layout, build, and release flow. If you only want to use the tool — read README instead.

Repo layout

netswitch/
├── .gitea/
│   └── workflows/release.yml          ← CI: tag-driven build + Gitea Release
├── src/
│   └── netswitch.ps1                  ← the whole tool (~150 lines)
├── CHANGELOG.md                       ← Keep a Changelog format, newest first
├── CONTRIBUTING.md                    ← this file
├── LICENSE / README.md / SECURITY.md
└── .gitignore

Run from source (no exe)

powershell -ExecutionPolicy Bypass -File src/netswitch.ps1

The script self-elevates through UAC if you launched it without admin.

Build the portable .exe locally

Install-Module ps2exe -Scope CurrentUser
Invoke-ps2exe -inputFile src/netswitch.ps1 -outputFile netswitch.exe `
    -title "netswitch" -description "NIC IP/DHCP toggle - made by engelgardt" `
    -company "engelgardt" -version "1.0.0.0" `
    -requireAdmin

Cut a release

  1. Update src/netswitch.ps1 — bump $NetswitchVersion to X.Y.Z.
  2. Update CHANGELOG.md — move items from [Unreleased] into a new [X.Y.Z] section with today's date.
  3. Commit: git commit -am "vX.Y.Z: …".
  4. Tag: git tag vX.Y.Z.
  5. Push: git push && git push --tags.

Gitea Actions picks up the tag, builds the exe, writes the SHA-256, and creates the Gitea Release with the zip attached.

Where features go

The whole tool is a single PowerShell file with these sections (in order):

  1. $NetswitchVersion / $Repo — top of file.
  2. Self-elevate block — UAC if non-admin.
  3. Banner — Write-Host title.
  4. Test-NetswitchUpdate — Gitea /releases/latest poll.
  5. Adapter filter + picker$skipDescriptionPattern, $skipMediaTypes, Get-NetAdapter | Where-Object {...}.
  6. Mode prompt — Static / DHCP.
  7. Static branchnetsh interface ipv4 set address ... static ....
  8. DHCP branchnetsh interface ipv4 set address ... source=dhcp.
  9. Current config displayGet-NetIPAddress | Format-Table.

If a section grows past ~50 lines, factor it into src/lib/<thing>.ps1 and dot-source it from the main file.