|
| 1 | +/* |
| 2 | + * Copyright The Backstage Authors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import fs from 'fs'; |
| 18 | +import path from 'path'; |
| 19 | + |
| 20 | +const workspacesDir = path.resolve('workspaces'); |
| 21 | + |
| 22 | +// Only include directories that contain a `.auto-version-bump` marker file |
| 23 | +function getWorkspaceDirs() { |
| 24 | + return fs.readdirSync(workspacesDir).filter(entry => { |
| 25 | + const dirPath = path.join(workspacesDir, entry); |
| 26 | + const bumpFile = path.join(dirPath, '.auto-version-bump'); |
| 27 | + |
| 28 | + return fs.statSync(dirPath).isDirectory() && fs.existsSync(bumpFile); |
| 29 | + }); |
| 30 | +} |
| 31 | + |
| 32 | +const workspaces = getWorkspaceDirs().sort(); |
| 33 | + |
| 34 | +// Final matrix: one workspace per job |
| 35 | +const matrix = workspaces.map(workspace => ({ workspace })); |
| 36 | + |
| 37 | +console.log(JSON.stringify(matrix)); |
0 commit comments