browsertrix/docs/js/insertversion.js
Ilya Kreymer a9ab17fc61
publish helm chart on release (fixes #1114) (#1117) (#1123)
- no longer using :latest by default in values.yaml, instead updating version with each release
- set chart version to match app version in Chart.yaml
- update version in helm chart and values.yaml as part of update-version.sh script
- update test.yaml and local-config.yaml to enable using :latest tag images
- ci: add ci script for packaging current helm chart
- docs: updates docs to indicate deploying directly from GitHub release
- docs: add script to fill in latest version for 'VERSION' using custom script
- chart: set local_service_port to 30870 by default, but use only if no ingress.
- default values.yaml set up for local deployment, local-config.yaml contains additional commented out examples
- ci draft: add deployment info to draft with helm install command for current version
- test: fix password check test
2023-08-30 12:02:02 -07:00

37 lines
859 B
JavaScript

const KEY = "/.__source";
let retries = 0;
function loadVersion() {
const value = self.sessionStorage.getItem(KEY);
if (value) {
parseVersion(value);
} else if (retries++ < 10) {
setTimeout(loadVersion, 500);
}
}
function parseVersion(string) {
const version = JSON.parse(string).version;
if (!version) {
return;
}
const elems = document.querySelectorAll("insert-version");
for (const elem of elems) {
try {
const code = elem.parentElement.nextElementSibling.querySelector("code");
code.childNodes.forEach((node) => {
if (node.nodeType === Node.TEXT_NODE) {
node.nodeValue = node.nodeValue.replaceAll("VERSION", version);
}
});
} catch (e) {
}
}
}
if (window.location.pathname.startsWith("/deploy/local")) {
window.addEventListener("load", () => loadVersion());
}