Skip to content

Commit 9c62c1f

Browse files
committed
chore(ci): use name by workspaces
1 parent 9c9846f commit 9c62c1f

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ jobs:
3535
- name: Install dependencies
3636
run: npm ci
3737

38+
- name: Read workspaces
39+
id: workspaces
40+
run: |
41+
WORKSPACES=$(node -e "const fs=require('fs'); const ws=JSON.parse(fs.readFileSync('package.json','utf8')).workspaces||[]; console.log(ws.join(' '));")
42+
echo "list=$WORKSPACES" >> $GITHUB_OUTPUT
43+
echo "Workspaces: $WORKSPACES"
44+
45+
- name: Build all workspaces
46+
run: npm run build -ws --if-present
47+
3848
- name: Update package.json versions
3949
run: |
4050
node -e "
@@ -43,7 +53,7 @@ jobs:
4353
import { fileURLToPath } from 'url';
4454
4555
const __dirname = path.dirname(fileURLToPath(import.meta.url));
46-
const workspaces = ['packages/payment', 'packages/identity', 'packages/terminal'];
56+
const workspaces = '${{ steps.workspaces.outputs.list }}'.split(' ').filter(Boolean);
4757
const version = '${{ steps.tag_version.outputs.version }}';
4858
4959
for (const workspace of workspaces) {
@@ -66,18 +76,12 @@ jobs:
6676
VERSION="${{ steps.tag_version.outputs.version }}"
6777
IS_STABLE=$(echo "$VERSION" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' && echo "true" || echo "false")
6878
69-
for workspace in packages/payment packages/identity packages/terminal; do
79+
for workspace in ${{ steps.workspaces.outputs.list }}; do
7080
echo "Publishing $workspace..."
71-
cd "$workspace"
72-
npm install
73-
npm run build
74-
7581
if [ "$IS_STABLE" = "true" ]; then
76-
npm publish --provenance
82+
npm publish --provenance --workspace "$workspace"
7783
else
78-
npm publish --provenance --tag next
84+
npm publish --provenance --tag next --workspace "$workspace"
7985
fi
80-
81-
cd ../..
8286
done
8387

0 commit comments

Comments
 (0)