mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 19:19:03 +01: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}" | WEB_EXT_ID="{1410742d-b377-40e7-a9db-63dc9c6ec99c}" | ||||||
| 
 | 
 | ||||||
| VERSION=$(jq -r ".version" manifest.json) |  | ||||||
| 
 |  | ||||||
| ARTIFACT_NAME=trilium-web-clipper-firefox | ARTIFACT_NAME=trilium-web-clipper-firefox | ||||||
| BUILD_DIR=dist/$ARTIFACT_NAME | BUILD_DIR=dist/$ARTIFACT_NAME | ||||||
| 
 | 
 | ||||||
| @ -16,7 +14,7 @@ cd dist/"${ARTIFACT_NAME}" || exit | |||||||
| 
 | 
 | ||||||
| jq '.name = "Trilium Web Clipper"' manifest.json | sponge manifest.json | 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 .. | cd .. | ||||||
| rm -r "${ARTIFACT_NAME}" | rm -r "${ARTIFACT_NAME}" | ||||||
| @ -42,9 +42,10 @@ echo "Tagging commit with $TAG" | |||||||
| git tag "$TAG" | git tag "$TAG" | ||||||
| git push origin "$TAG" | git push origin "$TAG" | ||||||
| 
 | 
 | ||||||
| bin/build-firefox.sh | bin/release-firefox.sh | ||||||
| 
 | 
 | ||||||
| FIREFOX_BUILD=trilium_web_clipper-$VERSION-an+fx.xpi | FIREFOX_BUILD=trilium_web_clipper-$VERSION-an+fx.xpi | ||||||
|  | CHROME_BUILD=trilium_web_clipper-${VERSION}-chrome.crx | ||||||
| 
 | 
 | ||||||
| echo "Creating release in GitHub" | echo "Creating release in GitHub" | ||||||
| 
 | 
 | ||||||
| @ -52,11 +53,18 @@ github-release release \ | |||||||
|     --tag "$TAG" \ |     --tag "$TAG" \ | ||||||
|     --name "$TAG release" |     --name "$TAG release" | ||||||
| 
 | 
 | ||||||
| echo "Uploading build package" | echo "Uploading firefox build package" | ||||||
| 
 | 
 | ||||||
| github-release upload \ | github-release upload \ | ||||||
|     --tag "$TAG" \ |     --tag "$TAG" \ | ||||||
|     --name "$FIREFOX_BUILD" \ |     --name "$FIREFOX_BUILD" \ | ||||||
|     --file "dist/$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!" | echo "Release finished!" | ||||||
| @ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|   "manifest_version": 2, |   "manifest_version": 2, | ||||||
|   "name": "Trilium Web Clipper (dev)", |   "name": "Trilium Web Clipper (dev)", | ||||||
|   "version": "0.1.0", |   "version": "0.0.1", | ||||||
|   "description": "Save web clippings to Trilium Notes.", |   "description": "Save web clippings to Trilium Notes.", | ||||||
|   "homepage_url": "https://github.com/zadam/trilium-web-clipper", |   "homepage_url": "https://github.com/zadam/trilium-web-clipper", | ||||||
|   "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", |   "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>`; |             statusText = `<span style="color: red">Not found</span>`; | ||||||
|             isConnected = false; |             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') { |         else if (triliumSearch.status === 'found-desktop') { | ||||||
|             statusText = `<span style="color: green">Connected on port ${triliumSearch.port}</span>`; |             statusText = `<span style="color: green">Connected on port ${triliumSearch.port}</span>`; | ||||||
|             isConnected = true; |             isConnected = true; | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | const PROTOCOL_VERSION_MAJOR = 2; | ||||||
|  | 
 | ||||||
| function isDevEnv() { | function isDevEnv() { | ||||||
| 	const manifest = browser.runtime.getManifest(); | 	const manifest = browser.runtime.getManifest(); | ||||||
| 
 | 
 | ||||||
| @ -28,6 +30,26 @@ class TriliumServerFacade { | |||||||
| 		this.sendTriliumSearchStatusToPopup(); | 		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() { | 	async triggerSearchForTrilium() { | ||||||
| 		this.setTriliumSearch({ status: 'searching' }); | 		this.setTriliumSearch({ status: 'searching' }); | ||||||
| 
 | 
 | ||||||
| @ -46,7 +68,7 @@ class TriliumServerFacade { | |||||||
| 				const json = JSON.parse(text); | 				const json = JSON.parse(text); | ||||||
| 
 | 
 | ||||||
| 				if (json.appName === 'trilium') { | 				if (json.appName === 'trilium') { | ||||||
| 					this.setTriliumSearch({ | 					this.setTriliumSearchWithVersionCheck(json, { | ||||||
| 						status: 'found-desktop', | 						status: 'found-desktop', | ||||||
| 						port: testedPort, | 						port: testedPort, | ||||||
| 						url: 'http://127.0.0.1:' + testedPort | 						url: 'http://127.0.0.1:' + testedPort | ||||||
| @ -78,11 +100,12 @@ class TriliumServerFacade { | |||||||
| 				const json = JSON.parse(text); | 				const json = JSON.parse(text); | ||||||
| 
 | 
 | ||||||
| 				if (json.appName === 'trilium') { | 				if (json.appName === 'trilium') { | ||||||
| 					this.setTriliumSearch({ | 					this.setTriliumSearchWithVersionCheck(json, { | ||||||
| 						status: 'found-server', | 						status: 'found-server', | ||||||
| 						url: triliumServerUrl, | 						url: triliumServerUrl, | ||||||
| 						token: authToken | 						token: authToken | ||||||
| 					}); | 					}); | ||||||
|  | 
 | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam