mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-23 10:26:16 -05:00
Add live update info
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": 12
|
||||
"version": 13
|
||||
}
|
||||
@@ -4,20 +4,38 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
yarn build-web-view
|
||||
COMMIT_SHA=$(git rev-parse HEAD)
|
||||
COMMIT_REF=$(git branch --show-current)
|
||||
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
|
||||
COMMIT_DATE=$(git log -1 --pretty=format:"%cI")
|
||||
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
cat <<EOF > web/public/live-update.json
|
||||
{
|
||||
"commitSha": "$COMMIT_SHA",
|
||||
"commitRef": "$COMMIT_REF",
|
||||
"commitMessage": "$COMMIT_MESSAGE",
|
||||
"commitDate": "$COMMIT_DATE",
|
||||
"buildDate": "$BUILD_DATE"
|
||||
}
|
||||
EOF
|
||||
|
||||
cat web/public/live-update.json
|
||||
|
||||
#yarn build-web-view
|
||||
|
||||
echo npx @capawesome/cli apps:bundles:create \
|
||||
--app-id 969bc540-8077-492f-8403-b554bee5de50 \
|
||||
--channel default \
|
||||
--commitMessage "$(git log -1 --pretty=format:"%s")" \
|
||||
--commitRef $commitRef \
|
||||
--commitSha $commitSha \
|
||||
--commitMessage "$COMMIT_MESSAGE" \
|
||||
--commitRef $COMMIT_REF \
|
||||
--commitSha $COMMIT_SHA \
|
||||
--path web/out
|
||||
|
||||
npx @capawesome/cli apps:bundles:create \
|
||||
--app-id 969bc540-8077-492f-8403-b554bee5de50 \
|
||||
--channel default \
|
||||
--commitMessage "$(git log -1 --pretty=format:"%s")" \
|
||||
--commitRef $commitRef \
|
||||
--commitSha $commitSha \
|
||||
--commitMessage "$COMMIT_MESSAGE" \
|
||||
--commitRef $COMMIT_REF \
|
||||
--commitSha $COMMIT_SHA \
|
||||
--path web/out
|
||||
|
||||
3
web/.gitignore
vendored
3
web/.gitignore
vendored
@@ -8,4 +8,5 @@ tsconfig.tsbuildinfo
|
||||
testing
|
||||
|
||||
.env
|
||||
.env.local
|
||||
.env.local
|
||||
/public/live-update.json
|
||||
|
||||
@@ -10,6 +10,7 @@ import {api} from "web/lib/api"
|
||||
import {githubRepo} from "common/constants"
|
||||
import {CustomLink} from "web/components/links"
|
||||
import {Button} from "web/components/buttons/button"
|
||||
import {getLiveUpdateInfo} from "web/lib/live-update";
|
||||
|
||||
export type WebBuild = {
|
||||
gitSha?: string
|
||||
@@ -22,6 +23,7 @@ export type LiveUpdateInfo = {
|
||||
bundleId?: string | null
|
||||
commitSha?: string
|
||||
commitMessage?: string
|
||||
commitDate?: string
|
||||
}
|
||||
|
||||
export type Android = {
|
||||
@@ -75,13 +77,15 @@ function useDiagnostics() {
|
||||
if (Capacitor.isNativePlatform()) {
|
||||
const appInfo = await App.getInfo()
|
||||
const bundle = await LiveUpdate.getCurrentBundle().catch(() => {return {bundleId: null}})
|
||||
const buildInfo = await getLiveUpdateInfo().catch(() => null)
|
||||
diagnostics.android = {
|
||||
appVersion: appInfo.version,
|
||||
buildNumber: appInfo.build,
|
||||
liveUpdate: {
|
||||
bundleId: bundle.bundleId,
|
||||
commitSha: process.env.CAPAWESOME_BUILD_GIT_COMMIT_SHA || 'N/A',
|
||||
commitMessage: process.env.CAPAWESOME_BUILD_GIT_COMMIT_MESSAGE || 'N/A',
|
||||
bundleId: bundle?.bundleId,
|
||||
commitSha: buildInfo?.commitSha,
|
||||
commitMessage: buildInfo?.commitMessage,
|
||||
commitDate: buildInfo?.commitDate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
web/lib/live-update.ts
Normal file
12
web/lib/live-update.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
type BuildInfo = {
|
||||
commitSha: string;
|
||||
commitRef: string;
|
||||
commitMessage: string;
|
||||
commitDate: string;
|
||||
buildDate: string;
|
||||
};
|
||||
|
||||
export async function getLiveUpdateInfo(): Promise<BuildInfo> {
|
||||
const res = await fetch("/live-update.json", { cache: "no-store" });
|
||||
return res.json();
|
||||
}
|
||||
Reference in New Issue
Block a user