chore: extract version from main.go in flake.nix
Use builtins.match to parse version from cmd/homelab-deploy/main.go so only one location needs updating when bumping versions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -113,9 +113,7 @@ Follow semantic versioning:
|
||||
- **Minor** (0.x.0): Non-breaking changes adding features
|
||||
- **Major** (x.0.0): Breaking changes
|
||||
|
||||
Update the version in **both** locations:
|
||||
1. `const version` in `cmd/homelab-deploy/main.go`
|
||||
2. `version` field in `flake.nix`
|
||||
Update `const version` in `cmd/homelab-deploy/main.go`. The Nix build extracts the version from there automatically.
|
||||
|
||||
**When to bump**: If any Go code has changed, bump the version before committing. Do this automatically when asked to commit. On feature branches, only bump once per branch (check if version has already been bumped compared to master).
|
||||
|
||||
|
||||
@@ -15,11 +15,16 @@
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = pkgsFor system;
|
||||
# Extract version from main.go
|
||||
version = builtins.head (
|
||||
builtins.match ''.*const version = "([^"]+)".*''
|
||||
(builtins.readFile ./cmd/homelab-deploy/main.go)
|
||||
);
|
||||
in
|
||||
{
|
||||
homelab-deploy = pkgs.buildGoModule {
|
||||
pname = "homelab-deploy";
|
||||
version = "0.1.0";
|
||||
inherit version;
|
||||
src = ./.;
|
||||
vendorHash = "sha256-JXa+obN62zrrwXlplqojY7dvEunUqDdSTee6N8c5JTg=";
|
||||
subPackages = [ "cmd/homelab-deploy" ];
|
||||
|
||||
Reference in New Issue
Block a user