mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
use the gitref as a prerelease header
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
48e8a7e5a4
commit
038117ff26
1
Makefile
1
Makefile
@ -111,6 +111,7 @@ build-extension-types: node_modules src/extensions/npm/extensions/dist
|
||||
publish-npm: node_modules build-npm
|
||||
./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
||||
cd src/extensions/npm/extensions && npm publish --access=public --tag=${NPM_RELEASE_TAG:-latest}
|
||||
git restore src/extensions/npm/extensions/package.json
|
||||
|
||||
.PHONY: docs
|
||||
docs:
|
||||
|
||||
@ -22,8 +22,20 @@ import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import packageInfo from "../src/extensions/npm/extensions/package.json";
|
||||
import appInfo from "../package.json";
|
||||
import { SemVer } from "semver";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
const packagePath = path.join(__dirname, "../src/extensions/npm/extensions/package.json");
|
||||
const { NPM_RELEASE_TAG = "latest" } = process.env;
|
||||
const version = new SemVer(appInfo.version);
|
||||
|
||||
packageInfo.version = appInfo.version;
|
||||
fs.writeFileSync(packagePath, `${JSON.stringify(packageInfo, null, 2)}\n`);
|
||||
if (NPM_RELEASE_TAG !== "latest") {
|
||||
const gitRef = execSync("git rev-parse --short HEAD", {
|
||||
encoding: "utf-8",
|
||||
});
|
||||
|
||||
version.inc("prerelease", gitRef.trim());
|
||||
}
|
||||
|
||||
packageInfo.version = version.format();
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, "../src/extensions/npm/extensions/package.json"), `${JSON.stringify(packageInfo, null, 2)}\n`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user