Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: add git hash & platform to version string

thecodrr684b7ee0ee53
diff --git a/apps/web/.github/workflows/release.yml b/apps/web/.github/workflows/release.yml
index ddeacd2c1..2b916214f 100644
--- a/apps/web/.github/workflows/release.yml
+++ b/apps/web/.github/workflows/release.yml
@@ -34,6 +34,7 @@ jobs:
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.PERSONAL_GH_TOKEN }}
+ build_script_name: "build:desktop"
# macOS code signing certificate
mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
diff --git a/apps/web/package.json b/apps/web/package.json
index ae522e34f..7c002ccba 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -73,8 +73,9 @@
"webpack-bundle-analyzer": "^4.4.0"
},
"scripts": {
- "start": "REACT_APP_CI=true react-scripts start",
- "build": "react-scripts build",
+ "start": "REACT_APP_GIT_HASH=\"$(git rev-parse --short HEAD)\" REACT_APP_PLATFORM=web REACT_APP_CI=true react-scripts start",
+ "build": "REACT_APP_GIT_HASH=\"$(git rev-parse --short HEAD)\" REACT_APP_PLATFORM=web react-scripts build",
+ "build:desktop": "REACT_APP_GIT_HASH=\"$(git rev-parse --short HEAD)\" REACT_APP_PLATFORM=desktop react-scripts build",
"deploy": "./scripts/deploy.sh",
"debug": "BROWSER=none react-scripts start",
"test": "REACT_APP_CI=true BROWSER= jest --runInBand -c jest.e2e.config.js",
diff --git a/apps/web/src/utils/useVersion.js b/apps/web/src/utils/useVersion.js
index 9f83b3497..71e932139 100644
--- a/apps/web/src/utils/useVersion.js
+++ b/apps/web/src/utils/useVersion.js
@@ -3,7 +3,11 @@ import { db } from "../common/db";
import config from "./config";
var APP_VERSION = {
- formatted: format(1350),
+ formatted: format(
+ 1350,
+ process.env.REACT_APP_GIT_HASH,
+ process.env.REACT_APP_PLATFORM
+ ),
numerical: 1350,
appUpdated: false,
appUpdateable: false,
@@ -30,12 +34,14 @@ export default useVersion;
/**
*
* @param {number} version
+ * @param {string} hash
+ * @param {"web"|"desktop"} type
*/
-function format(version) {
+function format(version, hash, type) {
const parts = version.toString().split("");
return `${parts[0]}.${parts[1]}.${parts[2]}${
parts[3] && parts[3] !== "0" ? parts[3] : ""
- }`;
+ }-${hash}-${type}`;
}
export function getAppVersion() {