Skip to content
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3202339
Just a test commit from the new branch
ethelynmatias Sep 2, 2025
5c5cdbf
Add cloud repository on run file
ethelynmatias Sep 2, 2025
13135be
Add cloud repository on run file
ethelynmatias Sep 2, 2025
b857575
Add cloud repository on run file
ethelynmatias Sep 2, 2025
1002bae
Add cloud repository on run file
ethelynmatias Sep 2, 2025
45eb8a2
Add cloud repository on run file
ethelynmatias Sep 2, 2025
da77383
Add cloud repository on run file
ethelynmatias Sep 2, 2025
abb6b6b
Add cloud repository on run file
ethelynmatias Sep 2, 2025
22851aa
Add cloud repository on run file
ethelynmatias Sep 2, 2025
c46e20b
Add cloud repository on run file
ethelynmatias Sep 2, 2025
31ee14a
Add cloud repository on run file
ethelynmatias Sep 2, 2025
80b7ea7
Add cloud repository on run file
ethelynmatias Sep 2, 2025
5e468d7
Add cloud repository on run file
ethelynmatias Sep 2, 2025
1728295
Add cloud upload curl function
ethelynmatias Sep 2, 2025
fcc266c
Update after-release.ts
ethelynmatias Sep 15, 2025
53e3e50
Update after-release.ts
ethelynmatias Sep 15, 2025
503ccdf
Update after-release.ts
ethelynmatias Sep 15, 2025
7a839d3
Added changelog readme txt file
ethelynmatias Sep 15, 2025
cd5cdd8
Debug changelog
ethelynmatias Sep 15, 2025
8a2498f
Fix the tangible to cloud issue with var
ethelynmatias Sep 15, 2025
f230c49
escape changelog
ethelynmatias Sep 15, 2025
e2fde05
change log
ethelynmatias Sep 15, 2025
89b1b1d
Update after-release.ts
ethelynmatias Sep 17, 2025
5d706b4
Update after-release.ts
ethelynmatias Sep 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions after-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -12,6 +14,8 @@ 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 {
Expand All @@ -27,8 +31,64 @@ export async function afterRelease() {
const [orgName, repoName] = repoFullName.split('/')
const repoUrl = `https://github.com/${repoFullName}`

// Get package.json contents
let pluginId: number
let productId: number

try {
const packageJsonContent = await fs.readFile(packageJsonPath, 'utf8')
const packageJson = JSON.parse(packageJsonContent)

// Set ids
pluginId = packageJson?.tangible?.pluginId
productId = packageJson?.tangible?.productId

} catch (error) {
console.log('Could not read package.json:', error.message)
}

// Try reading changelog from readme.txt
let changelog = 'No changelog provided'

try {
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)
}

const data = {
type: 'git',
pluginId,
productId,
event: isCommit ? 'commit' : eventType,
source: repoUrl,
time: new Date().toISOString().slice(0, 19).replace('T', ' '),
Expand Down Expand Up @@ -59,6 +119,36 @@ export async function afterRelease() {
: `${repoName}.zip`
}

// Upload zip on tangible cloud website
if (pluginId && productId) {
try {
const localZipPath = path.join(publishPath, file);
// Check if the local file exists
await fs.access(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=${isTag ? gitRefName : 'unknown'}"`,
`--form "changelog=${changelog.replace(/"/g, '\\"')}"`,
`--form "slug=${repoName}"`
].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)
console.log()
Expand Down