fix(ci): bump only TeleUploader flake version, not Bun overlay
prepare.mjs previously replaced the FIRST version="X" string in flake.nix, which is the Bun overlay override (line ~17), not the TeleUploader package version (pname = "teleuploader", line ~30). Store path derives from the TeleUploader version, so the Bun override got clobbered to the app version while the store path stayed at 1.1.1 -> deploy reused the old derivation and the VPS profile never advanced. Now prepare.mjs anchors on pname = "teleuploader" and bumps that block only, leaving the Bun 1.3.14 override intact. Verified: flake.nix keeps bun version=1.3.14, teleuploader version becomes the semver-version. Also restores bun overlay version=1.3.14 (was overwritten to 1.2.0).
This commit is contained in:
+20
-2
@@ -12,6 +12,11 @@
|
|||||||
* while the VPS profile stayed on the old build. By bumping flake.nix's
|
* while the VPS profile stayed on the old build. By bumping flake.nix's
|
||||||
* `version` on every release, the Nix derivation always changes and the
|
* `version` on every release, the Nix derivation always changes and the
|
||||||
* store path is always fresh.
|
* store path is always fresh.
|
||||||
|
*
|
||||||
|
* IMPORTANT: only bump the TeleUploader package version (the block whose
|
||||||
|
* `pname = "teleuploader"` precedes it), never the Bun overlay version that
|
||||||
|
* appears earlier in the file. Store path is derived from the
|
||||||
|
* teleuploader package's `version`.
|
||||||
*/
|
*/
|
||||||
import { readFileSync, writeFileSync } from 'node:fs';
|
import { readFileSync, writeFileSync } from 'node:fs';
|
||||||
|
|
||||||
@@ -27,9 +32,22 @@ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|||||||
const flakePath = 'flake.nix';
|
const flakePath = 'flake.nix';
|
||||||
let flake = readFileSync(flakePath, 'utf8');
|
let flake = readFileSync(flakePath, 'utf8');
|
||||||
const target = nextVersion ?? pkg.version;
|
const target = nextVersion ?? pkg.version;
|
||||||
const replaced = flake.replace(/version = "\d+\.\d+\.\d+";/, `version = "${target}";`);
|
|
||||||
|
const anchor = 'pname = "teleuploader";';
|
||||||
|
const anchorIdx = flake.indexOf(anchor);
|
||||||
|
if (anchorIdx === -1) {
|
||||||
|
throw new Error(`prepare.mjs: TeleUploader pname anchor not found in ${flakePath}`);
|
||||||
|
}
|
||||||
|
const rest = flake.slice(anchorIdx);
|
||||||
|
const verMatch = rest.match(/(\s*)version = "\d+\.\d+\.\d+";/);
|
||||||
|
if (!verMatch) {
|
||||||
|
throw new Error(`prepare.mjs: could not locate TeleUploader version block in ${flakePath}`);
|
||||||
|
}
|
||||||
|
const replaced =
|
||||||
|
flake.slice(0, anchorIdx) +
|
||||||
|
rest.replace(/(\s*)version = "\d+\.\d+\.\d+";/, `$1version = "${target}";`);
|
||||||
if (!replaced.includes(`version = "${target}";`)) {
|
if (!replaced.includes(`version = "${target}";`)) {
|
||||||
throw new Error(`prepare.mjs: could not update version in ${flakePath} (pattern not found)`);
|
throw new Error(`prepare.mjs: replacement did not land in ${flakePath}`);
|
||||||
}
|
}
|
||||||
writeFileSync(flakePath, replaced);
|
writeFileSync(flakePath, replaced);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
overlays = [
|
overlays = [
|
||||||
(self: super: {
|
(self: super: {
|
||||||
bun = super.bun.overrideAttrs (old: rec {
|
bun = super.bun.overrideAttrs (old: rec {
|
||||||
version = "1.2.0";
|
version = "1.3.14";
|
||||||
src = super.fetchzip {
|
src = super.fetchzip {
|
||||||
url = "https://github.com/oven-sh/bun/releases/download/bun-v1.3.14/bun-linux-x64.zip";
|
url = "https://github.com/oven-sh/bun/releases/download/bun-v1.3.14/bun-linux-x64.zip";
|
||||||
sha256 = "sha256:189kasncnfpq6q37q3w80dv2a92w79w20x2x6hf1fbkir5gyvzlb";
|
sha256 = "sha256:189kasncnfpq6q37q3w80dv2a92w79w20x2x6hf1fbkir5gyvzlb";
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# TeleUploader package
|
# TeleUploader package
|
||||||
teleuploader = pkgs.stdenvNoCC.mkDerivation rec {
|
teleuploader = pkgs.stdenvNoCC.mkDerivation rec {
|
||||||
pname = "teleuploader";
|
pname = "teleuploader";
|
||||||
version = "1.1.1";
|
version = "1.2.0";
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user