feat: do not rely on git for versioning
It causes lots of pain when building with `nix` for a local `flake.nix`. Not sure if it's a good general solution: * now it requires a manual step of updating `./version` on each release. * we're losing commit hash abbreviation, like `0.5.3-5-gbe5a291` I guess, this can be fixed by installing git-pre-commit-hook, but even then it'd be wrong, because the output of `git describe --tags --always` won't be the same before and after commit.
This commit is contained in:
parent
af733eb311
commit
8268de92c4
@ -28,10 +28,9 @@ rec {
|
||||
};
|
||||
in {
|
||||
formatter = pkgs.alejandra;
|
||||
packages = rec {
|
||||
packages = {
|
||||
headplane = pkgs.callPackage ./nix/package.nix {};
|
||||
headplane-agent = pkgs.callPackage ./nix/agent.nix {};
|
||||
default = headplane;
|
||||
};
|
||||
devShell = pkgs.devshell.mkShell rec {
|
||||
name = description;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
{buildGoModule}:
|
||||
buildGoModule {
|
||||
pname = "hp_agent";
|
||||
# TODO: take the latest `git tag`, if commits do not match, append `-SNAPSHOT`.
|
||||
version = "0.5.3";
|
||||
version = builtins.replaceStrings ["\n"] [""] (builtins.readFile ../version);
|
||||
src = ../.;
|
||||
vendorHash = "sha256-G0kahv3mPTL/mxU2U+0IytJaFVPXMbMBktbLMfM0BO8=";
|
||||
ldflags = ["-s" "-w"];
|
||||
|
||||
@ -9,11 +9,7 @@
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "headplane";
|
||||
|
||||
# TODO: take the latest `git tag`, if commits do not match, append `-SNAPSHOT`.
|
||||
version = "0.5.3";
|
||||
|
||||
# TODO: requires `.git` directory.
|
||||
version = builtins.replaceStrings ["\n"] [""] (builtins.readFile ../version);
|
||||
src = ../.;
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
||||
@ -2,7 +2,7 @@ import { reactRouter } from '@react-router/dev/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import babel from 'vite-plugin-babel';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
import { execSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import tailwindcss from 'tailwindcss';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
|
||||
@ -11,8 +11,7 @@ if (prefix.endsWith('/')) {
|
||||
throw new Error('Prefix must not end with a slash');
|
||||
}
|
||||
|
||||
// Load the version via git tags
|
||||
const version = execSync('git describe --tags --always').toString().trim();
|
||||
const version = fs.readFileSync("version", "utf8");
|
||||
if (!version) {
|
||||
throw new Error('Unable to execute git describe');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user