Skip to content

Commit d684976

Browse files
committed
Automate syncing of roopik.roodio extension version
1 parent 3f78d9b commit d684976

5 files changed

Lines changed: 76 additions & 2 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Sync Extension Version Script
5+
*
6+
* Automatically syncs the extension version from extensions/roopik-roo/package.json
7+
* to the builtInExtensions array in product.json.
8+
*
9+
* This ensures the IDE build downloads the correct version from the marketplace.
10+
*
11+
* Usage:
12+
* node .github/scripts/sync-extension-version.cjs
13+
*/
14+
15+
const fs = require('fs');
16+
const path = require('path');
17+
18+
const ROOT_DIR = path.join(__dirname, '..', '..');
19+
const PRODUCT_JSON_PATH = path.join(ROOT_DIR, 'product.json');
20+
const EXTENSION_PACKAGE_JSON_PATH = path.join(ROOT_DIR, 'extensions', 'roopik-roo', 'package.json');
21+
22+
function syncVersion() {
23+
try {
24+
// Read extension package.json
25+
const extensionPackage = JSON.parse(fs.readFileSync(EXTENSION_PACKAGE_JSON_PATH, 'utf8'));
26+
const extensionVersion = extensionPackage.version;
27+
28+
if (!extensionVersion) {
29+
console.error('Error: Could not find version in extension package.json');
30+
process.exit(1);
31+
}
32+
33+
// Read product.json
34+
const productJson = JSON.parse(fs.readFileSync(PRODUCT_JSON_PATH, 'utf8'));
35+
36+
// Find the roopik.roodio extension in builtInExtensions
37+
const roodioExtension = productJson.builtInExtensions?.find(ext => ext.name === 'roopik.roodio');
38+
39+
if (!roodioExtension) {
40+
console.error('Error: Could not find roopik.roodio extension in product.json builtInExtensions');
41+
process.exit(1);
42+
}
43+
44+
const currentProductVersion = roodioExtension.version;
45+
46+
if (currentProductVersion === extensionVersion) {
47+
console.log(`Versions already in sync: ${extensionVersion}`);
48+
return;
49+
}
50+
51+
// Update the version
52+
roodioExtension.version = extensionVersion;
53+
54+
// Write back to product.json
55+
fs.writeFileSync(PRODUCT_JSON_PATH, JSON.stringify(productJson, null, '\t') + '\n', 'utf8');
56+
57+
console.log(`Updated product.json version: ${currentProductVersion} -> ${extensionVersion}`);
58+
59+
} catch (error) {
60+
console.error('Error syncing version:', error.message);
61+
process.exit(1);
62+
}
63+
}
64+
65+
syncVersion();

.github/workflows/build-linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
node-version-file: '.nvmrc'
2828
cache: 'npm'
2929

30+
- name: Sync Extension Version to product.json
31+
run: node .github/scripts/sync-extension-version.cjs
32+
3033
- name: Setup Python 3
3134
uses: actions/setup-python@v6
3235
with:

.github/workflows/build-macos.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
node-version-file: '.nvmrc'
2828
cache: 'npm'
2929

30+
- name: Sync Extension Version to product.json
31+
run: node .github/scripts/sync-extension-version.cjs
32+
3033
- name: Setup Python 3
3134
uses: actions/setup-python@v6
3235
with:

.github/workflows/build-windows.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
node-version-file: '.nvmrc'
2828
cache: 'npm'
2929

30+
- name: Sync Extension Version to product.json
31+
run: node .github/scripts/sync-extension-version.cjs
32+
3033
- name: Setup Python 3
3134
uses: actions/setup-python@v6
3235
with:

product.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",
6060
"builtInExtensions": [
6161
{
62-
"name": "roodio",
63-
"version": "3.37.1",
62+
"name": "roopik.roodio",
63+
"version": "3.37.2",
6464
"repo": "https://github.com/RoopikHQ/roopik",
6565
"metadata": {
6666
"id": "roopik.roodio",

0 commit comments

Comments
 (0)