File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
.github/actions/upload-versions Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ name : ' Upload Versions'
2+ description : ' Upload version information for public packages'
3+ runs :
4+ using : ' composite'
5+ steps :
6+ - name : Set up Node.js
7+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
8+ with :
9+ node-version : 22
10+ - name : Install glob package
11+ shell : bash
12+ run : npm install glob --no-package-lock
13+ - name : Write workspace versions as JSON file
14+ uses : actions/github-script@a3e7071a34d7e1f219a8a4de9a5e0a34d1ee1293
15+ with :
16+ script : |
17+ const fs = require('node:fs');
18+ const {globSync} = require('glob')
19+
20+ const packageJsonPaths = globSync('**/package.json', { ignore: ['**/node_modules/**'] })
21+ const output = {
22+ packages: [],
23+ };
24+
25+ for (const packageJsonPath of packageJsonPaths) {
26+ const contents = fs.readFileSync(packageJsonPath, 'utf8');
27+ const packageJson = JSON.parse(contents);
28+ if (packageJson.private) {
29+ continue;
30+ }
31+
32+ const pkg = {
33+ name: packageJson.name,
34+ version: packageJson.version,
35+ };
36+ output.packages.push(pkg);
37+ }
38+
39+ fs.writeFileSync('versions.json', JSON.stringify(output, null, 2));
40+ - name : Upload version file
41+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
42+ with :
43+ name : versions
44+ path : versions.json
You can’t perform that action at this time.
0 commit comments