Skip to content

Commit

Permalink
Merge pull request #27 from elecordapp/versioning-refactor
Browse files Browse the repository at this point in the history
Versioning refactor
  • Loading branch information
hazzuk authored Jan 26, 2025
2 parents d8fb3e9 + 77d5ba9 commit 9d3a294
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
# These must be set for fetchdep.sh to get the right branch
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
permissions: {} # No permissions required
jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "elecord-web",
"version": "1.11.90",
"version": "2.0.1",
"description": "Privacy focused chat app for gamers",
"author": "hazzuk",
"repository": {
"type": "git",
"url": "https://github.com/elecordapp/elecord-web"
},
"license": "SEE LICENSE IN README.md",
"license": "AGPL-3.0-only",
"files": [
"lib",
"res",
Expand Down
7 changes: 4 additions & 3 deletions scripts/get-version-from-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
set -e

# Since the deps are fetched from git, we can rev-parse
JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=12 HEAD)
VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop
echo $VECTOR_SHA-js-$JSSDK_SHA
JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=7 HEAD)
#VECTOR_SHA=$(git rev-parse --short=7 HEAD) # use the ACTUAL SHA rather than assume develop
#echo $VECTOR_SHA-js-$JSSDK_SHA
echo "${COMMIT_SHA:0:7}-js-$JSSDK_SHA"
2 changes: 1 addition & 1 deletion scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

if [ -n "$DIST_VERSION" ]; then
if [ -n "$DIST_VERSION" ] && [ "$GITHUB_REF_NAME" != "release" ]; then
version=$DIST_VERSION
else
version=`git describe --dirty --tags || echo unknown`
Expand Down
32 changes: 30 additions & 2 deletions src/components/views/auth/AuthFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,44 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/

import React, { ReactElement } from "react";
import React, { ReactElement, useEffect, useState } from "react";

import SdkConfig from "../../../SdkConfig";
import { _t } from "../../../languageHandler";

const fetchVersion = async (): Promise<string> => {
try {
const res = await fetch("version", {
method: "GET",
cache: "no-cache",
});
if (res.ok) {
const text = await res.text();
return text.trim().replace(/^v/, ""); // Normalize version if it starts with 'v'
}
console.error("Failed to fetch version: ", res.status);
return "unknown";
} catch (error) {
console.error("Error fetching version: ", error);
return "unknown";
}
};

const AuthFooter = (): ReactElement => {
const [version, setVersion] = useState<string>("");

useEffect(() => {
const loadVersion = async () => {
const fetchedVersion = await fetchVersion();
setVersion(fetchedVersion);
};
loadVersion();
}, []);

const brandingConfig = SdkConfig.getObject("branding");
const links = brandingConfig?.get("auth_footer_links") ?? [
{ text: "About", url: "https://elecord.app" },
{ text: "v2.0.1", url: "https://github.com/elecordapp/elecord-web/releases" },
{ text: version ? `${version}` : "Loading...", url: "https://github.com/elecordapp/elecord-web/releases" },
{ text: "Privacy", url: "https://github.com/elecordapp/elecord-web/blob/master/PRIVACY.md" },
{ text: "GitHub", url: "https://github.com/elecordapp/elecord-web" },
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
const cryptoVersion = this.context.getCrypto()?.getVersion() ?? "<not-enabled>";

return {
appVersion: `${_t("setting|help_about|brand_version", { brand })} 2.0.1 (${appVersion})`,
appVersion: `${_t("setting|help_about|brand_version", { brand })} (${appVersion})`,
cryptoVersion: `${_t("setting|help_about|crypto_version")} ${cryptoVersion}`,
};
}
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const VersionFilePlugin = require("webpack-version-file-plugin");

dotenv.config();
let ogImageUrl = process.env.RIOT_OG_IMAGE_URL;
if (!ogImageUrl) ogImageUrl = "https://app.element.io/themes/element/img/logos/opengraph.png";
if (!ogImageUrl) ogImageUrl = "https://web.elecord.app/themes/element/img/logos/opengraph.png";

const cssThemes = {
// CSS themes
Expand Down

0 comments on commit 9d3a294

Please sign in to comment.