Skip to content

Commit c9390dc

Browse files
committed
update publish-latest workflow with version input + remove on release trigger
1 parent db6e9e0 commit c9390dc

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/publish-latest.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
name: Publish latest builds
22

33
on:
4-
release:
5-
types: [created]
64
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to publish (e.g., 1.2.3)'
8+
required: true
9+
type: string
710

811
jobs:
912
publish:
@@ -24,6 +27,31 @@ jobs:
2427
- name: Install dependencies
2528
run: pnpm install --frozen-lockfile
2629

30+
- name: Validate version input
31+
run: |
32+
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
33+
echo "❌ Version must be in semantic version format (e.g., 1.2.3)"
34+
exit 1
35+
fi
36+
37+
- name: Update package versions
38+
run: |
39+
target_version="${{ github.event.inputs.version }}"
40+
echo "Setting version to: $target_version"
41+
42+
for dir in packages/*; do
43+
[ -f "$dir/package.json" ] || continue
44+
echo "Updating $dir/package.json..."
45+
node -e "
46+
const fs = require('fs');
47+
const path = './$dir/package.json';
48+
const pkg = require(path);
49+
pkg.version = '$target_version';
50+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2));
51+
console.log('Updated ' + pkg.name + ' to version ' + pkg.version);
52+
"
53+
done
54+
2755
- name: Build packages
2856
run: pnpm dlx turbo build --filter='./packages/*'
2957

0 commit comments

Comments
 (0)