From 3202339c1d434f29bea3d954f1f2d6d9dab0a71d Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 15:27:41 +0800 Subject: [PATCH 01/24] Just a test commit from the new branch --- after-release.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/after-release.ts b/after-release.ts index f3f7f15..e5e9bfe 100644 --- a/after-release.ts +++ b/after-release.ts @@ -59,6 +59,8 @@ export async function afterRelease() { : `${repoName}.zip` } + // Upload zip on tangible cloud website + if (!isTestEnvironment) { console.log(data) console.log() From 5c5cdbf87082aba307feb8477f168922c5b1b5dc Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 18:01:21 +0800 Subject: [PATCH 02/24] Add cloud repository on run file --- run | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/run b/run index 1e831eb..0260f4b 100755 --- a/run +++ b/run @@ -75,6 +75,27 @@ main() { echo -e "\n..Using project slug \"$PROJECT_SLUG\"\n" + # Extract plugin_id from plugin package.json + + PLUGIN_ID=`node -e "var pkg=require('./build/package.json');console.log((pkg.pluginId || ''))"` + + if [ -z "$PLUGIN_ID" ]; then + PLUGIN_ID=`node -e "console.log((pkg.tangible && pkg.tangible.pluginId) || '')"` + if [ -z "$PLUGIN_ID" ]; then + PLUGIN_ID=`node -e "console.log(require('./build/package.json').name || '')"` + fi + fi + + # Store product_id from plugin package.json + PRODUCT_ID=`node -e "var pkg=require('./build/package.json');console.log((pkg.productId || ''))"` + + if [ -z "$PRODUCT_ID" ]; then + PRODUCT_ID=`node -e "console.log((pkg.tangible && pkg.tangible.productId) || '')"` + if [ -z "$PRODUCT_ID" ]; then + PRODUCT_ID=`node -e "console.log(require('./build/package.json').name || '')"` + fi + fi + fi if [ -f "build/.deployignore" ]; then @@ -276,6 +297,18 @@ main() { local SOURCE_URL=https://bitbucket.org/tangibleinc/"$BITBUCKET_REPO_SLUG" local TARGET_URL=https://api.tangible.one + + echo -e "\nDeploy to Clouds Downloads\n" + # Remove all \n and \n\n using sed + #CLEAN_CHANGELOG=$(echo -e "$CHANGELOG" | sed ':a;N;$!ba;s/\n/ /g') # Replace \n with spaces + # Upload the ZIP file and additional form data + curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads" \ + --form files=@"$ZIP_FILE" \ + --form "product_id=$PRODUCT_ID" \ + --form "plugin_id=$PLUGIN_ID" \ + --form "version=$BITBUCKET_TAG" \ + --form "slug=$BITBUCKET_REPO_SLUG" + printf '{ "type": "git", "source": "%s", "time": "%s", "%s": "%s" }' "$SOURCE_URL" "$DEPLOY_TIMESTAMP" "$EVENT_KEY" "$EVENT_VALUE" > $DEPLOY_META_FILE echo -e "Post event to $TARGET_URL\n" From 13135bedc02e0a2e72dae027606b924b33567fdd Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 18:08:18 +0800 Subject: [PATCH 03/24] Add cloud repository on run file --- after-release.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index e5e9bfe..57d12eb 100644 --- a/after-release.ts +++ b/after-release.ts @@ -8,7 +8,7 @@ import { getEventMeta, isTestEnvironment, getProjectConfig } from './common' * - Deploy metadata */ export async function afterRelease() { - console.log('After release') + console.log('After release - Test Branch') const projectPath = process.cwd() const deployMetaPath = path.join(projectPath, 'deploy-meta.json') @@ -60,7 +60,7 @@ export async function afterRelease() { } // Upload zip on tangible cloud website - + if (!isTestEnvironment) { console.log(data) console.log() From b857575c0569678408d81b826338e76a08fa2e83 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:03:54 +0800 Subject: [PATCH 04/24] Add cloud repository on run file --- run | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/run b/run index 0260f4b..c489263 100755 --- a/run +++ b/run @@ -302,6 +302,9 @@ main() { # Remove all \n and \n\n using sed #CLEAN_CHANGELOG=$(echo -e "$CHANGELOG" | sed ':a;N;$!ba;s/\n/ /g') # Replace \n with spaces # Upload the ZIP file and additional form data + + ZIP_URL="https://github.com/TangibleInc/$REPO_SLUG/releases/download/$BITBUCKET_TAG/$ZIP_FILE" + curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads" \ --form files=@"$ZIP_FILE" \ --form "product_id=$PRODUCT_ID" \ @@ -309,6 +312,14 @@ main() { --form "version=$BITBUCKET_TAG" \ --form "slug=$BITBUCKET_REPO_SLUG" + # Print function for the ZIP URL + print_f() { + echo "ZIP URL: $ZIP_URL" + echo "File: $ZIP_FILE" + echo "Tag: $BITBUCKET_TAG" + echo "Repo Slug: $REPO_SLUG" + } + printf '{ "type": "git", "source": "%s", "time": "%s", "%s": "%s" }' "$SOURCE_URL" "$DEPLOY_TIMESTAMP" "$EVENT_KEY" "$EVENT_VALUE" > $DEPLOY_META_FILE echo -e "Post event to $TARGET_URL\n" From 1002baef4c02034e51e530fd4a68611d61006812 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:11:37 +0800 Subject: [PATCH 05/24] Add cloud repository on run file --- after-release.ts | 4 ++++ run | 44 -------------------------------------------- 2 files changed, 4 insertions(+), 44 deletions(-) diff --git a/after-release.ts b/after-release.ts index 57d12eb..811a825 100644 --- a/after-release.ts +++ b/after-release.ts @@ -27,8 +27,12 @@ export async function afterRelease() { const [orgName, repoName] = repoFullName.split('/') const repoUrl = `https://github.com/${repoFullName}` + console.log(projectPath); + const data = { type: 'git', + pluginId:53, + productId:82, event: isCommit ? 'commit' : eventType, source: repoUrl, time: new Date().toISOString().slice(0, 19).replace('T', ' '), diff --git a/run b/run index c489263..1e831eb 100755 --- a/run +++ b/run @@ -75,27 +75,6 @@ main() { echo -e "\n..Using project slug \"$PROJECT_SLUG\"\n" - # Extract plugin_id from plugin package.json - - PLUGIN_ID=`node -e "var pkg=require('./build/package.json');console.log((pkg.pluginId || ''))"` - - if [ -z "$PLUGIN_ID" ]; then - PLUGIN_ID=`node -e "console.log((pkg.tangible && pkg.tangible.pluginId) || '')"` - if [ -z "$PLUGIN_ID" ]; then - PLUGIN_ID=`node -e "console.log(require('./build/package.json').name || '')"` - fi - fi - - # Store product_id from plugin package.json - PRODUCT_ID=`node -e "var pkg=require('./build/package.json');console.log((pkg.productId || ''))"` - - if [ -z "$PRODUCT_ID" ]; then - PRODUCT_ID=`node -e "console.log((pkg.tangible && pkg.tangible.productId) || '')"` - if [ -z "$PRODUCT_ID" ]; then - PRODUCT_ID=`node -e "console.log(require('./build/package.json').name || '')"` - fi - fi - fi if [ -f "build/.deployignore" ]; then @@ -297,29 +276,6 @@ main() { local SOURCE_URL=https://bitbucket.org/tangibleinc/"$BITBUCKET_REPO_SLUG" local TARGET_URL=https://api.tangible.one - - echo -e "\nDeploy to Clouds Downloads\n" - # Remove all \n and \n\n using sed - #CLEAN_CHANGELOG=$(echo -e "$CHANGELOG" | sed ':a;N;$!ba;s/\n/ /g') # Replace \n with spaces - # Upload the ZIP file and additional form data - - ZIP_URL="https://github.com/TangibleInc/$REPO_SLUG/releases/download/$BITBUCKET_TAG/$ZIP_FILE" - - curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads" \ - --form files=@"$ZIP_FILE" \ - --form "product_id=$PRODUCT_ID" \ - --form "plugin_id=$PLUGIN_ID" \ - --form "version=$BITBUCKET_TAG" \ - --form "slug=$BITBUCKET_REPO_SLUG" - - # Print function for the ZIP URL - print_f() { - echo "ZIP URL: $ZIP_URL" - echo "File: $ZIP_FILE" - echo "Tag: $BITBUCKET_TAG" - echo "Repo Slug: $REPO_SLUG" - } - printf '{ "type": "git", "source": "%s", "time": "%s", "%s": "%s" }' "$SOURCE_URL" "$DEPLOY_TIMESTAMP" "$EVENT_KEY" "$EVENT_VALUE" > $DEPLOY_META_FILE echo -e "Post event to $TARGET_URL\n" From 45eb8a234e1907969ce94079aa9be2b970b35a6a Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:16:34 +0800 Subject: [PATCH 06/24] Add cloud repository on run file --- after-release.ts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index 811a825..5c42e1a 100644 --- a/after-release.ts +++ b/after-release.ts @@ -12,6 +12,7 @@ export async function afterRelease() { const projectPath = process.cwd() const deployMetaPath = path.join(projectPath, 'deploy-meta.json') + const packageJsonPath = path.join(projectPath, 'package.json') const config = (await getProjectConfig({ projectPath })) || {} const { @@ -29,10 +30,28 @@ export async function afterRelease() { console.log(projectPath); + // Get package.json contents + let pluginId: number | null = null + let productId: number | null = null + + try { + const packageJsonContent = await fs.readFile(packageJsonPath, 'utf8') + const packageJson = JSON.parse(packageJsonContent) + + console.log(packageJson); + + // Get plugin_id and product_id from package.json + //pluginId = packageJson.plugin_id || packageJson.tangible?.plugin_id || pluginId + //productId = packageJson.product_id || packageJson.tangible?.product_id || productId + + } catch (error) { + console.warn('Could not read package.json:', error.message) + } + const data = { type: 'git', - pluginId:53, - productId:82, + pluginId:pluginId, + productId:productId, event: isCommit ? 'commit' : eventType, source: repoUrl, time: new Date().toISOString().slice(0, 19).replace('T', ' '), From da7738326d42495ef0d5536aa75a6bbe3f4fd370 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:20:09 +0800 Subject: [PATCH 07/24] Add cloud repository on run file --- after-release.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/after-release.ts b/after-release.ts index 5c42e1a..3757313 100644 --- a/after-release.ts +++ b/after-release.ts @@ -28,8 +28,6 @@ export async function afterRelease() { const [orgName, repoName] = repoFullName.split('/') const repoUrl = `https://github.com/${repoFullName}` - console.log(projectPath); - // Get package.json contents let pluginId: number | null = null let productId: number | null = null @@ -38,11 +36,9 @@ export async function afterRelease() { const packageJsonContent = await fs.readFile(packageJsonPath, 'utf8') const packageJson = JSON.parse(packageJsonContent) - console.log(packageJson); - - // Get plugin_id and product_id from package.json - //pluginId = packageJson.plugin_id || packageJson.tangible?.plugin_id || pluginId - //productId = packageJson.product_id || packageJson.tangible?.product_id || productId + // Set ids + pluginId = packageJson.pluginId || packageJson.tangible?.pluginId || pluginId + productId = packageJson.productId || packageJson.tangible?.productId || productId } catch (error) { console.warn('Could not read package.json:', error.message) From abb6b6b5a8d55a184bc2d876fe6559de7f995999 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:24:40 +0800 Subject: [PATCH 08/24] Add cloud repository on run file --- after-release.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index 3757313..a3d3996 100644 --- a/after-release.ts +++ b/after-release.ts @@ -37,8 +37,8 @@ export async function afterRelease() { const packageJson = JSON.parse(packageJsonContent) // Set ids - pluginId = packageJson.pluginId || packageJson.tangible?.pluginId || pluginId - productId = packageJson.productId || packageJson.tangible?.productId || productId + pluginId = packageJson.pluginId || packageJson.cloud?.pluginId || pluginId + productId = packageJson.productId || packageJson.cloud?.productId || productId } catch (error) { console.warn('Could not read package.json:', error.message) From 22851aa67faee65c903f7421664c8b25153e6108 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:35:28 +0800 Subject: [PATCH 09/24] Add cloud repository on run file --- after-release.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/after-release.ts b/after-release.ts index a3d3996..9e90455 100644 --- a/after-release.ts +++ b/after-release.ts @@ -2,6 +2,8 @@ import { Glob } from 'bun' import path from 'node:path' import fs from 'node:fs/promises' import { getEventMeta, isTestEnvironment, getProjectConfig } from './common' +import { execSync } from 'node:child_process' + /** * After release * @@ -79,6 +81,31 @@ export async function afterRelease() { } // Upload zip on tangible cloud website + if (pluginId && productId) { + try { + await fs.access(data.fileDownload); + + // Build the curl command + const curlCommand = [ + 'curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads"', + `--form files=@"${data.fileDownload}"`, + `--form "product_id=${productId}"`, + `--form "plugin_id=${pluginId}"`, + `--form "version=${isTag}"`, + `--form "slug=${data.file}"` + ].join(' \\\n '); + + console.log('Executing curl command:'); + console.log(curlCommand); + + // Execute the curl command + const result = execSync(curlCommand, { encoding: 'utf-8' }); + console.log('Upload successful:', result); + + } catch (error) { + console.log('File not uploaded on cloud'+ error.message) + } + } if (!isTestEnvironment) { console.log(data) From c46e20bac255161e0435b09acbb182d68fcc9a5e Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:39:45 +0800 Subject: [PATCH 10/24] Add cloud repository on run file --- after-release.ts | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/after-release.ts b/after-release.ts index 9e90455..a79147c 100644 --- a/after-release.ts +++ b/after-release.ts @@ -83,27 +83,34 @@ export async function afterRelease() { // Upload zip on tangible cloud website if (pluginId && productId) { try { - await fs.access(data.fileDownload); - - // Build the curl command - const curlCommand = [ - 'curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads"', - `--form files=@"${data.fileDownload}"`, - `--form "product_id=${productId}"`, - `--form "plugin_id=${pluginId}"`, - `--form "version=${isTag}"`, - `--form "slug=${data.file}"` - ].join(' \\\n '); - - console.log('Executing curl command:'); - console.log(curlCommand); - - // Execute the curl command - const result = execSync(curlCommand, { encoding: 'utf-8' }); - console.log('Upload successful:', result); + // data.fileDownload is a URL, not a local file - we need the local file path + // Assuming you have the local zip file path stored somewhere + const localZipPath = path.join('./publish', data.fileDownload); // Adjust this path as needed + + // Check if the local file exists + await fs.access(localZipPath); + console.log(`Found local zip file: ${localZipPath}`); + + // Build the curl command - use local file path, not URL + const curlCommand = [ + 'curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads"', + `--form files=@"${localZipPath}"`, + `--form "product_id=${productId}"`, + `--form "plugin_id=${pluginId}"`, + `--form "version=${data.isTag || 'unknown'}"`, // Use actual version from your data + `--form "changelog='No changelog provided'"`, + `--form "slug=${repoName}"` // Use repository name, not filename + ].join(' \\\n '); + + console.log('Executing curl command:'); + console.log(curlCommand); + + // Execute the curl command + const result = execSync(curlCommand, { encoding: 'utf-8' }); + console.log('Upload successful:', result); } catch (error) { - console.log('File not uploaded on cloud'+ error.message) + console.log('File not uploaded on cloud: ' + error.message); } } From 31ee14a0a094a7167b7c74a0ae8c3b24f09944a8 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:42:31 +0800 Subject: [PATCH 11/24] Add cloud repository on run file --- after-release.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/after-release.ts b/after-release.ts index a79147c..7d9f06e 100644 --- a/after-release.ts +++ b/after-release.ts @@ -83,9 +83,8 @@ export async function afterRelease() { // Upload zip on tangible cloud website if (pluginId && productId) { try { - // data.fileDownload is a URL, not a local file - we need the local file path - // Assuming you have the local zip file path stored somewhere - const localZipPath = path.join('./publish', data.fileDownload); // Adjust this path as needed + + const localZipPath = data.fileDownload; // Adjust this path as needed // Check if the local file exists await fs.access(localZipPath); From 80b7ea7808575e1357f073280256ac501545922c Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 20:49:15 +0800 Subject: [PATCH 12/24] Add cloud repository on run file --- after-release.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/after-release.ts b/after-release.ts index 7d9f06e..d93a5c6 100644 --- a/after-release.ts +++ b/after-release.ts @@ -83,22 +83,19 @@ export async function afterRelease() { // Upload zip on tangible cloud website if (pluginId && productId) { try { - - const localZipPath = data.fileDownload; // Adjust this path as needed - + const localZipPath = path.join(publishPath, file); // Check if the local file exists await fs.access(localZipPath); - console.log(`Found local zip file: ${localZipPath}`); - + // Build the curl command - use local file path, not URL const curlCommand = [ 'curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads"', `--form files=@"${localZipPath}"`, `--form "product_id=${productId}"`, `--form "plugin_id=${pluginId}"`, - `--form "version=${data.isTag || 'unknown'}"`, // Use actual version from your data + `--form "version=${isTag ? gitRefName : 'unknown'}"`, `--form "changelog='No changelog provided'"`, - `--form "slug=${repoName}"` // Use repository name, not filename + `--form "slug=${repoName}"` ].join(' \\\n '); console.log('Executing curl command:'); From 5e468d7aa61fbd3d8bb82370295422b9a7f0be23 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 21:00:42 +0800 Subject: [PATCH 13/24] Add cloud repository on run file --- after-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/after-release.ts b/after-release.ts index d93a5c6..00c2173 100644 --- a/after-release.ts +++ b/after-release.ts @@ -10,7 +10,7 @@ import { execSync } from 'node:child_process' * - Deploy metadata */ export async function afterRelease() { - console.log('After release - Test Branch') + console.log('After release') const projectPath = process.cwd() const deployMetaPath = path.join(projectPath, 'deploy-meta.json') From 1728295e50a9c3f21731c874a25d07bb4d79a922 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Tue, 2 Sep 2025 21:01:45 +0800 Subject: [PATCH 14/24] Add cloud upload curl function --- after-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/after-release.ts b/after-release.ts index 00c2173..c4f98f6 100644 --- a/after-release.ts +++ b/after-release.ts @@ -43,7 +43,7 @@ export async function afterRelease() { productId = packageJson.productId || packageJson.cloud?.productId || productId } catch (error) { - console.warn('Could not read package.json:', error.message) + console.log('Could not read package.json:', error.message) } const data = { From fcc266cc8644c9530fa81ddf094cbd9610ae0368 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 16:05:24 +0800 Subject: [PATCH 15/24] Update after-release.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 3λiȯ+ --- after-release.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index c4f98f6..fa9a91c 100644 --- a/after-release.ts +++ b/after-release.ts @@ -39,8 +39,8 @@ export async function afterRelease() { const packageJson = JSON.parse(packageJsonContent) // Set ids - pluginId = packageJson.pluginId || packageJson.cloud?.pluginId || pluginId - productId = packageJson.productId || packageJson.cloud?.productId || productId + pluginId = packageJson?.tangible?.pluginId + productId = packageJson?.tangible?.productId } catch (error) { console.log('Could not read package.json:', error.message) From 53e3e50192f5dfdea9eafc817917f4c49e081edb Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 16:05:34 +0800 Subject: [PATCH 16/24] Update after-release.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 3λiȯ+ --- after-release.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index fa9a91c..72b4f01 100644 --- a/after-release.ts +++ b/after-release.ts @@ -48,8 +48,8 @@ export async function afterRelease() { const data = { type: 'git', - pluginId:pluginId, - productId:productId, + pluginId, + productId, event: isCommit ? 'commit' : eventType, source: repoUrl, time: new Date().toISOString().slice(0, 19).replace('T', ' '), From 503ccdfc92394d1f9d9d3bcd9154360e8e853fe9 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 16:05:44 +0800 Subject: [PATCH 17/24] Update after-release.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 3λiȯ+ --- after-release.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index 72b4f01..7840f06 100644 --- a/after-release.ts +++ b/after-release.ts @@ -31,8 +31,8 @@ export async function afterRelease() { const repoUrl = `https://github.com/${repoFullName}` // Get package.json contents - let pluginId: number | null = null - let productId: number | null = null + let pluginId: number + let productId: number try { const packageJsonContent = await fs.readFile(packageJsonPath, 'utf8') From 7a839d34f30aa216b7bdf7e65c6cc9ee647f2c39 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 16:08:58 +0800 Subject: [PATCH 18/24] Added changelog readme txt file --- after-release.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/after-release.ts b/after-release.ts index 7840f06..5107cb3 100644 --- a/after-release.ts +++ b/after-release.ts @@ -15,6 +15,7 @@ export async function afterRelease() { const projectPath = process.cwd() const deployMetaPath = path.join(projectPath, 'deploy-meta.json') const packageJsonPath = path.join(projectPath, 'package.json') + const readmePath = path.join(projectPath, 'readme.txt') const config = (await getProjectConfig({ projectPath })) || {} const { @@ -46,6 +47,15 @@ export async function afterRelease() { console.log('Could not read package.json:', error.message) } + // Try reading changelog from readme.txt + let changelog = 'No changelog provided' + + try { + changelog = await fs.readFile(readmePath, 'utf8') + } catch (error) { + console.log('Could not read changelog (readme.txt):', error.message) + } + const data = { type: 'git', pluginId, @@ -94,7 +104,7 @@ export async function afterRelease() { `--form "product_id=${productId}"`, `--form "plugin_id=${pluginId}"`, `--form "version=${isTag ? gitRefName : 'unknown'}"`, - `--form "changelog='No changelog provided'"`, + `--form "changelog=${changelog.replace(/"/g, '\\"')}"`, `--form "slug=${repoName}"` ].join(' \\\n '); From cd5cdd861d6a006760a4f58c469dbac300e3fe39 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 16:28:26 +0800 Subject: [PATCH 19/24] Debug changelog --- after-release.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/after-release.ts b/after-release.ts index 5107cb3..6c2590a 100644 --- a/after-release.ts +++ b/after-release.ts @@ -51,7 +51,7 @@ export async function afterRelease() { let changelog = 'No changelog provided' try { - changelog = await fs.readFile(readmePath, 'utf8') + //changelog = await fs.readFile(readmePath, 'utf8') } catch (error) { console.log('Could not read changelog (readme.txt):', error.message) } From 8a2498f125c38900062feebe55544a1760febec5 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 16:33:22 +0800 Subject: [PATCH 20/24] Fix the tangible to cloud issue with var --- after-release.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/after-release.ts b/after-release.ts index 6c2590a..5c07888 100644 --- a/after-release.ts +++ b/after-release.ts @@ -40,8 +40,8 @@ export async function afterRelease() { const packageJson = JSON.parse(packageJsonContent) // Set ids - pluginId = packageJson?.tangible?.pluginId - productId = packageJson?.tangible?.productId + pluginId = packageJson?.cloud?.pluginId + productId = packageJson?.cloud?.productId } catch (error) { console.log('Could not read package.json:', error.message) @@ -51,7 +51,7 @@ export async function afterRelease() { let changelog = 'No changelog provided' try { - //changelog = await fs.readFile(readmePath, 'utf8') + changelog = await fs.readFile(readmePath, 'utf8') } catch (error) { console.log('Could not read changelog (readme.txt):', error.message) } From f230c4954a7c7a0cedf570a9f2358254747f8f6a Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 16:54:39 +0800 Subject: [PATCH 21/24] escape changelog --- after-release.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index 5c07888..e6184f8 100644 --- a/after-release.ts +++ b/after-release.ts @@ -96,7 +96,9 @@ export async function afterRelease() { const localZipPath = path.join(publishPath, file); // Check if the local file exists await fs.access(localZipPath); - + + const escapedChangelog = changelog.replace(/"/g, '\\"') .replace(/\n/g, '\\n'); + // Build the curl command - use local file path, not URL const curlCommand = [ 'curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads"', @@ -104,7 +106,7 @@ export async function afterRelease() { `--form "product_id=${productId}"`, `--form "plugin_id=${pluginId}"`, `--form "version=${isTag ? gitRefName : 'unknown'}"`, - `--form "changelog=${changelog.replace(/"/g, '\\"')}"`, + `--form "changelog=${escapedChangelog}"`, `--form "slug=${repoName}"` ].join(' \\\n '); From e2fde05d3bb6518ba1ac1718b9e060011e734494 Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Mon, 15 Sep 2025 17:06:09 +0800 Subject: [PATCH 22/24] change log --- after-release.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/after-release.ts b/after-release.ts index e6184f8..5c07888 100644 --- a/after-release.ts +++ b/after-release.ts @@ -96,9 +96,7 @@ export async function afterRelease() { const localZipPath = path.join(publishPath, file); // Check if the local file exists await fs.access(localZipPath); - - const escapedChangelog = changelog.replace(/"/g, '\\"') .replace(/\n/g, '\\n'); - + // Build the curl command - use local file path, not URL const curlCommand = [ 'curl -X POST "https://cloud.tangible.one/api/bitbucket/downloads"', @@ -106,7 +104,7 @@ export async function afterRelease() { `--form "product_id=${productId}"`, `--form "plugin_id=${pluginId}"`, `--form "version=${isTag ? gitRefName : 'unknown'}"`, - `--form "changelog=${escapedChangelog}"`, + `--form "changelog=${changelog.replace(/"/g, '\\"')}"`, `--form "slug=${repoName}"` ].join(' \\\n '); From 89b1b1d2a4d70239003e12929adc72565842db3c Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Wed, 17 Sep 2025 12:24:05 +0800 Subject: [PATCH 23/24] Update after-release.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 3λiȯ+ --- after-release.ts | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/after-release.ts b/after-release.ts index 5c07888..977e1e7 100644 --- a/after-release.ts +++ b/after-release.ts @@ -51,7 +51,36 @@ export async function afterRelease() { let changelog = 'No changelog provided' try { - changelog = await fs.readFile(readmePath, 'utf8') + const sectionHeader = '== Changelog ==' + const lines = (await fs.readFile('./readme.txt', 'utf8')) + .split(sectionHeader) + .pop() + .split('\n') + + const changeList: string[] = [] + let captureLine = false + + for (const line of lines) { + // Version header + if (line.startsWith('= ')) { + if (captureLine) { + // Skip previous versions + break + } + // Start gathering change list + captureLine = true + } else if (line.startsWith('== ')) { + // Next section + break + } + if (captureLine) { + changeList.push(line) + } + } + + if (changeList.length) { + changelog = changeList.join('\n') + } } catch (error) { console.log('Could not read changelog (readme.txt):', error.message) } From 5d706b460607785395d18d3130aee994bb89c95b Mon Sep 17 00:00:00 2001 From: Ethelyn Matias Date: Wed, 17 Sep 2025 12:24:14 +0800 Subject: [PATCH 24/24] Update after-release.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 3λiȯ+ --- after-release.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/after-release.ts b/after-release.ts index 977e1e7..68a6ac7 100644 --- a/after-release.ts +++ b/after-release.ts @@ -40,8 +40,8 @@ export async function afterRelease() { const packageJson = JSON.parse(packageJsonContent) // Set ids - pluginId = packageJson?.cloud?.pluginId - productId = packageJson?.cloud?.productId + pluginId = packageJson?.tangible?.pluginId + productId = packageJson?.tangible?.productId } catch (error) { console.log('Could not read package.json:', error.message)