Skip to content

Commit c8757be

Browse files
committed
feat(ci): add NPM publish dry-run to PR validation
- Add dedicated job to preview version bumps - Show which packages would be published - Run check-packages-need-publishing in dry-run mode - Provides early feedback on PR changes before merge Helps catch publishing issues early in PR review process.
1 parent ee6be21 commit c8757be

1 file changed

Lines changed: 59 additions & 3 deletions

File tree

.ado/azure-pipelines.yml

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
yarn prettier
2929
displayName: 'check prettier'
3030
31+
- script: |
32+
yarn lint-lockfile
33+
displayName: 'run lint-lockfile'
34+
3135
- script: |
3236
yarn buildci
3337
displayName: 'yarn buildci [test]'
@@ -36,6 +40,58 @@ jobs:
3640
yarn check-for-changed-files
3741
displayName: 'verify API and Ensure Changed Files'
3842
43+
# Dedicated job to preview version bumps and package publishing
44+
- job: NPMPublishDryRun
45+
displayName: NPM Publish Dry Run
46+
pool:
47+
vmImage: 'ubuntu-latest'
48+
timeoutInMinutes: 30
49+
cancelTimeoutInMinutes: 5
50+
51+
steps:
52+
- checkout: self
53+
persistCredentials: true
54+
55+
- template: templates/setup-repo.yml
56+
57+
- script: |
58+
set -eox pipefail
59+
echo "=========================================="
60+
echo "Running beachball bump (dry-run)..."
61+
echo "=========================================="
62+
npx beachball bump --verbose
63+
64+
echo ""
65+
echo "=========================================="
66+
echo "Packages that would be bumped:"
67+
echo "=========================================="
68+
69+
# Show which package.json files were modified
70+
git diff --name-only | grep "package.json" | grep -v "^package.json$" | while read pkg; do
71+
if [ -f "$pkg" ]; then
72+
NAME=$(grep '"name"' "$pkg" | head -1 | sed 's/.*"name": "\(.*\)".*/\1/')
73+
VERSION=$(grep '"version"' "$pkg" | head -1 | sed 's/.*"version": "\(.*\)".*/\1/')
74+
PRIVATE=$(grep '"private"' "$pkg" | head -1 || echo "")
75+
76+
if [ -z "$PRIVATE" ]; then
77+
echo " 📦 $NAME@$VERSION"
78+
fi
79+
fi
80+
done
81+
82+
# Reset the changes so they don't affect other steps
83+
git reset --hard HEAD
84+
displayName: 'Preview version bumps (dry-run)'
85+
86+
- script: |
87+
set -eox pipefail
88+
echo ""
89+
echo "=========================================="
90+
echo "Checking which packages need publishing..."
91+
echo "=========================================="
92+
node scripts/check-packages-need-publishing.ts --dry-run
93+
displayName: 'Check packages to publish (dry-run)'
94+
3995
- job: AndroidPR
4096
displayName: Android PR
4197
pool:
@@ -146,8 +202,7 @@ jobs:
146202
displayName: Windows PR
147203
pool:
148204
name: rnw-pool-4
149-
demands:
150-
- ImageOverride -equals rnw-img-vs2022-node18
205+
demands: ImageOverride -equals rnw-img-vs2022-node22
151206
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
152207
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
153208

@@ -168,7 +223,8 @@ jobs:
168223
- job: Win32PR
169224
displayName: Win32 PR
170225
pool:
171-
vmImage: 'windows-2019'
226+
name: rnw-pool-4
227+
demands: ImageOverride -equals rnw-img-vs2022-node22
172228
timeoutInMinutes: 60
173229
cancelTimeoutInMinutes: 5
174230

0 commit comments

Comments
 (0)