feat: auto update frontend flake hash
This commit is contained in:
parent
6e87f0b388
commit
d3c0ecb5d4
4 changed files with 98 additions and 12 deletions
6
container/flake.lock
generated
6
container/flake.lock
generated
|
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779467186,
|
||||
"narHash": "sha256-nOesoDCiXcUftqbRBMz9tt4blI5PvljMWbm3kuCA+0s=",
|
||||
"lastModified": 1780511130,
|
||||
"narHash": "sha256-2v9lT4ya59Lh1FqPeLnz1MoX9y/wz2huqfe9RtQZITk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b77b3de8775677f84492abe84635f87b0e153f0f",
|
||||
"rev": "535f3e6942cb1cead3929c604320d3db54b542b9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
64
devenv.lock
64
devenv.lock
|
|
@ -17,6 +17,62 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1778507602,
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "61ab0e80d9c7ab14c256b5b453d8b3fb0189ba0a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1762808025,
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779102034,
|
||||
|
|
@ -52,11 +108,15 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"git-hooks": "git-hooks",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-cmake3": "nixpkgs-cmake3"
|
||||
"nixpkgs-cmake3": "nixpkgs-cmake3",
|
||||
"pre-commit-hooks": [
|
||||
"git-hooks"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
flake.nix
11
flake.nix
|
|
@ -36,6 +36,11 @@
|
|||
cargo = rustToolchain;
|
||||
rustc = rustToolchain;
|
||||
};
|
||||
frontendCargoDeps = rustPlatform.fetchCargoVendor {
|
||||
src = ./.;
|
||||
name = "trictrac-frontend-vendor";
|
||||
hash = "sha256-XBxdRT/f69GDfVc18/DnnAiY1vjMGMWfcYot0K0jevg=";
|
||||
};
|
||||
# Must match the wasm-bindgen version in Cargo.lock
|
||||
wasm-bindgen-version = "0.2.118";
|
||||
# wasm-bindgen-version = "0.2.121";
|
||||
|
|
@ -52,12 +57,6 @@
|
|||
# hash = "sha256-DPdCDPTAPBrbqLUqnCwQu1dePs9lGg85JCJOCIr9qjU=";
|
||||
# };
|
||||
# };
|
||||
|
||||
frontendCargoDeps = rustPlatform.fetchCargoVendor {
|
||||
src = ./.;
|
||||
name = "trictrac-frontend-vendor";
|
||||
hash = "sha256-R75zHXKhv0nkBv6U24ZCAtwp1yaSbr0bFywWQHwhSkM=";
|
||||
};
|
||||
in
|
||||
final.stdenv.mkDerivation {
|
||||
name = "trictrac-front";
|
||||
|
|
|
|||
29
justfile
29
justfile
|
|
@ -9,9 +9,36 @@ bump version:
|
|||
git flow release start {{version}}
|
||||
sed -i '/^\[workspace\.package\]/,/^\[/{s/^version = ".*"/version = "{{version}}"/}' Cargo.toml
|
||||
sed -i 's/version = "[0-9.]*"; # trictrac-version/version = "{{version}}"; # trictrac-version/' flake.nix
|
||||
just frontend-flake-hash
|
||||
git add Cargo.toml flake.nix
|
||||
git commit -m "chore: bump version to {{version}}"
|
||||
@echo "Done. Finish with: git flow release finish {{version}}"
|
||||
@echo "Done. Finish with: `git flow release finish {{version}}`"
|
||||
|
||||
# Get new trictrac front-end nix package hash and update flake.nix with it
|
||||
frontend-flake-hash:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
FAKE_HASH="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
||||
# Match only non-commented hash lines (i.e. lines where 'hash' is the first non-space token)
|
||||
CURRENT_HASH=$(grep -P '^\s+hash = "' flake.nix | grep -oP 'sha256-[^"]+' | head -1)
|
||||
echo "Current hash: $CURRENT_HASH"
|
||||
sed -i "s|$CURRENT_HASH|$FAKE_HASH|" flake.nix
|
||||
set +e
|
||||
OUTPUT=$(nix build .#trictrac-front --no-link 2>&1)
|
||||
set -e
|
||||
NEW_HASH=$(echo "$OUTPUT" | grep -oP 'got:\s+\Ksha256-\S+' || true)
|
||||
if [ -n "$NEW_HASH" ]; then
|
||||
sed -i "s|$FAKE_HASH|$NEW_HASH|" flake.nix
|
||||
if [ "$NEW_HASH" = "$CURRENT_HASH" ]; then
|
||||
echo "Hash already up to date: $CURRENT_HASH"
|
||||
else
|
||||
echo "Updated: $CURRENT_HASH → $NEW_HASH"
|
||||
fi
|
||||
else
|
||||
sed -i "s|$FAKE_HASH|$CURRENT_HASH|" flake.nix
|
||||
printf "Unexpected build output (no hash mismatch found):\n%s\n" "$OUTPUT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Sync pages content to production server
|
||||
pages-deploy:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue