Skip to content

Commit 4273b23

Browse files
committed
fix(CI): setup multi-package publishing
1 parent b643a4b commit 4273b23

4 files changed

Lines changed: 32 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: Release
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- staging
5+
branches: [main, staging]
86

97
jobs:
108
release:

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
[
6363
"@semantic-release/exec",
6464
{
65-
"prepareCmd": "npm version ${nextRelease.version} --workspaces --no-git-tag-version",
66-
"publishCmd": "npm publish --workspaces"
65+
"prepareCmd": "node scripts/set-version.js ${nextRelease.version}",
66+
"publishCmd": "node scripts/publish.js"
6767
}
6868
],
6969
"@semantic-release/github"

scripts/publish.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { execSync } from 'child_process';
2+
3+
const pkgs = [
4+
'bindings/js/sdk',
5+
'implementations/js/client',
6+
];
7+
8+
// eslint-disable-next-line no-restricted-syntax
9+
for (const p of pkgs) {
10+
console.log(`Publishing ${p}`);
11+
execSync(`npm publish ${p}`, { stdio: 'inherit' });
12+
}

scripts/sync-version.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import fs from 'fs';
2+
3+
const version = process.argv[2];
4+
5+
const packages = [
6+
'bindings/js/sdk/package.json',
7+
'implementations/js/client/package.json',
8+
];
9+
10+
// eslint-disable-next-line no-restricted-syntax
11+
for (const p of packages) {
12+
const json = JSON.parse(fs.readFileSync(p, 'utf-8'));
13+
json.version = version;
14+
fs.writeFileSync(p, JSON.stringify(json, null, 2));
15+
}
16+
17+
console.log('Version set:', version);

0 commit comments

Comments
 (0)