mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
release scripts + check of version compatibility
This commit is contained in:
parent
94222e80cf
commit
8cf44780ce
25
bin/release-chrome.sh
Executable file
25
bin/release-chrome.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERSION=$(jq -r ".version" manifest.json)
|
||||
CHROME_EXTENSION_ID=dfhgmnfclbebfobmblelddiejjcijbjm
|
||||
|
||||
BUILD_DIR=trilium-web-clipper-chrome
|
||||
|
||||
rm -rf dist
|
||||
mkdir -p "dist/$BUILD_DIR"
|
||||
|
||||
cp -r icons lib options popup *.js manifest.json "dist/$BUILD_DIR"
|
||||
|
||||
cd dist/"${BUILD_DIR}" || exit
|
||||
|
||||
jq '.name = "Trilium Web Clipper"' manifest.json | sponge manifest.json
|
||||
jq 'del(.browser_specific_settings)' manifest.json | sponge manifest.json
|
||||
|
||||
EXT_FILE_NAME=trilium_web_clipper-${VERSION}-chrome.crx
|
||||
|
||||
zip -r ../${EXT_FILE_NAME} *
|
||||
|
||||
cd ..
|
||||
rm -r "${BUILD_DIR}"
|
||||
|
||||
webstore upload --source ${EXT_FILE_NAME} --auto-publish --extension-id "${CHROME_EXTENSION_ID}" --client-id "${CHROME_CLIENT_ID}" --client-secret "${CHROME_CLIENT_SECRET}" --refresh-token "${CHROME_REFRESH_TOKEN}"
|
@ -2,8 +2,6 @@
|
||||
|
||||
WEB_EXT_ID="{1410742d-b377-40e7-a9db-63dc9c6ec99c}"
|
||||
|
||||
VERSION=$(jq -r ".version" manifest.json)
|
||||
|
||||
ARTIFACT_NAME=trilium-web-clipper-firefox
|
||||
BUILD_DIR=dist/$ARTIFACT_NAME
|
||||
|
||||
@ -16,7 +14,7 @@ cd dist/"${ARTIFACT_NAME}" || exit
|
||||
|
||||
jq '.name = "Trilium Web Clipper"' manifest.json | sponge manifest.json
|
||||
|
||||
web-ext sign --id ${WEB_EXT_ID} --artifacts-dir ../
|
||||
web-ext sign --id ${WEB_EXT_ID} --artifacts-dir ../ --channel=listed
|
||||
|
||||
cd ..
|
||||
rm -r "${ARTIFACT_NAME}"
|
@ -42,9 +42,10 @@ echo "Tagging commit with $TAG"
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG"
|
||||
|
||||
bin/build-firefox.sh
|
||||
bin/release-firefox.sh
|
||||
|
||||
FIREFOX_BUILD=trilium_web_clipper-$VERSION-an+fx.xpi
|
||||
CHROME_BUILD=trilium_web_clipper-${VERSION}-chrome.crx
|
||||
|
||||
echo "Creating release in GitHub"
|
||||
|
||||
@ -52,11 +53,18 @@ github-release release \
|
||||
--tag "$TAG" \
|
||||
--name "$TAG release"
|
||||
|
||||
echo "Uploading build package"
|
||||
echo "Uploading firefox build package"
|
||||
|
||||
github-release upload \
|
||||
--tag "$TAG" \
|
||||
--name "$FIREFOX_BUILD" \
|
||||
--file "dist/$FIREFOX_BUILD"
|
||||
|
||||
echo "Uploading chrome build package"
|
||||
|
||||
github-release upload \
|
||||
--tag "$TAG" \
|
||||
--name "$CHROME_BUILD" \
|
||||
--file "dist/$CHROME_BUILD"
|
||||
|
||||
echo "Release finished!"
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Trilium Web Clipper (dev)",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.1",
|
||||
"description": "Save web clippings to Trilium Notes.",
|
||||
"homepage_url": "https://github.com/zadam/trilium-web-clipper",
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
|
@ -105,6 +105,12 @@ browser.runtime.onMessage.addListener(request => {
|
||||
statusText = `<span style="color: red">Not found</span>`;
|
||||
isConnected = false;
|
||||
}
|
||||
else if (triliumSearch.status === 'version-mismatch') {
|
||||
const whatToUpgrade = triliumSearch.extensionMajor > triliumSearch.triliumMajor ? "Trilium Notes" : "this extension";
|
||||
|
||||
statusText = `<span style="color: orange">Trilium instance found, but it is not compatible with this extension version. Please update ${whatToUpgrade} to the latest version.</span>`;
|
||||
isConnected = true;
|
||||
}
|
||||
else if (triliumSearch.status === 'found-desktop') {
|
||||
statusText = `<span style="color: green">Connected on port ${triliumSearch.port}</span>`;
|
||||
isConnected = true;
|
||||
|
@ -1,3 +1,5 @@
|
||||
const PROTOCOL_VERSION_MAJOR = 2;
|
||||
|
||||
function isDevEnv() {
|
||||
const manifest = browser.runtime.getManifest();
|
||||
|
||||
@ -28,11 +30,31 @@ class TriliumServerFacade {
|
||||
this.sendTriliumSearchStatusToPopup();
|
||||
}
|
||||
|
||||
setTriliumSearchWithVersionCheck(json, resp) {
|
||||
const [major, minor] = json.protocolVersion
|
||||
.split(".")
|
||||
.map(chunk => parseInt(chunk));
|
||||
|
||||
// minor version is intended to be used to dynamically limit features provided by extension
|
||||
// if some specific Trilium API is not supported. So far not needed.
|
||||
|
||||
if (major !== PROTOCOL_VERSION_MAJOR) {
|
||||
this.setTriliumSearch({
|
||||
status: 'version-mismatch',
|
||||
extensionMajor: PROTOCOL_VERSION_MAJOR,
|
||||
triliumMajor: major
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.setTriliumSearch(resp);
|
||||
}
|
||||
}
|
||||
|
||||
async triggerSearchForTrilium() {
|
||||
this.setTriliumSearch({ status: 'searching' });
|
||||
|
||||
const startingPort = await this.getStartingPort();
|
||||
|
||||
|
||||
for (let testedPort = startingPort; testedPort < startingPort + 10; testedPort++) {
|
||||
try {
|
||||
console.debug('Trying port ' + testedPort);
|
||||
@ -46,7 +68,7 @@ class TriliumServerFacade {
|
||||
const json = JSON.parse(text);
|
||||
|
||||
if (json.appName === 'trilium') {
|
||||
this.setTriliumSearch({
|
||||
this.setTriliumSearchWithVersionCheck(json, {
|
||||
status: 'found-desktop',
|
||||
port: testedPort,
|
||||
url: 'http://127.0.0.1:' + testedPort
|
||||
@ -78,11 +100,12 @@ class TriliumServerFacade {
|
||||
const json = JSON.parse(text);
|
||||
|
||||
if (json.appName === 'trilium') {
|
||||
this.setTriliumSearch({
|
||||
this.setTriliumSearchWithVersionCheck(json, {
|
||||
status: 'found-server',
|
||||
url: triliumServerUrl,
|
||||
token: authToken
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user