Skip to content

Commit 7764def

Browse files
committed
test: revert test mode later
1 parent b54b64c commit 7764def

File tree

3 files changed

+85
-10
lines changed

3 files changed

+85
-10
lines changed

.github/workflows/ci-cd.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,25 +269,34 @@ jobs:
269269
git push origin main
270270
git push origin --tags
271271
272-
- name: 📦 Publish to pub.dev
272+
- name: 🧪 Test package publication (DRY-RUN MODE)
273273
if: steps.check-changes.outputs.changed_packages > 0
274274
env:
275275
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }}
276276
run: |
277-
# Setup pub.dev credentials for auto-refresh
277+
echo "🚨 ========================================="
278+
echo "🚨 WARNING: RUNNING IN DRY-RUN TEST MODE"
279+
echo "🚨 NO PACKAGES WILL BE PUBLISHED TO PUB.DEV"
280+
echo "🚨 ========================================="
281+
echo ""
282+
283+
# Setup pub.dev credentials for validation (but not used in dry-run)
278284
if [ -n "$PUB_CREDENTIALS" ]; then
279-
echo "🔐 Setting up pub.dev credentials with auto-refresh..."
285+
echo "🔐 Setting up pub.dev credentials for validation..."
280286
mkdir -p ~/.pub-cache
281287
echo "$PUB_CREDENTIALS" > ~/.pub-cache/credentials.json
282-
echo "✅ Credentials configured with refresh token"
288+
echo "✅ Credentials configured (dry-run mode)"
283289
else
284-
echo "⚠️ PUB_CREDENTIALS not configured, skipping publish"
285-
exit 1
290+
echo "⚠️ PUB_CREDENTIALS not configured - continuing with dry-run"
286291
fi
287292
288-
# Publish packages (dart pub will auto-refresh token if needed)
289-
echo "📦 Publishing packages to pub.dev..."
290-
melos publish --no-dry-run --yes || echo "⚠️ Some packages may have failed to publish"
293+
# TEST MODE: Dry-run publish (not actually publishing to pub.dev)
294+
echo "🧪 Testing package publication (dry-run mode)..."
295+
melos publish --dry-run --yes || echo "⚠️ Some packages may have failed dry-run validation"
296+
297+
echo ""
298+
echo "✅ Dry-run completed successfully!"
299+
echo "📝 To enable real publishing, change --dry-run to --no-dry-run"
291300
292301
- name: 📋 Create GitHub release
293302
if: steps.check-changes.outputs.changed_packages > 0

.github/workflows/manual-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ jobs:
185185
186186
# Publish packages (dart pub will auto-refresh token if needed)
187187
echo "📦 Publishing packages to pub.dev..."
188-
melos publish --no-dry-run --yes
188+
# TEST MODE: Dry-run publish (not actually publishing to pub.dev)
189+
melos publish --dry-run --yes
189190
190191
- name: 📋 Create release summary
191192
if: github.event.inputs.dry_run == 'false'

scripts/toggle-publish-mode.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
# Script to toggle between dry-run (test) and real publish mode
4+
5+
MODE=${1:-"status"}
6+
7+
case $MODE in
8+
"test")
9+
echo "🧪 Switching to TEST mode (dry-run)..."
10+
11+
# CI/CD workflow
12+
sed -i '' 's/melos publish --no-dry-run/melos publish --dry-run/g' .github/workflows/ci-cd.yml
13+
sed -i '' 's/📦 Publish to pub.dev/🧪 Test package publication (DRY-RUN MODE)/g' .github/workflows/ci-cd.yml
14+
15+
# Manual release workflow
16+
sed -i '' 's/melos publish --no-dry-run/melos publish --dry-run/g' .github/workflows/manual-release.yml
17+
18+
echo "✅ Switched to TEST mode"
19+
echo "📝 No packages will be published to pub.dev"
20+
;;
21+
22+
"production")
23+
echo "🚀 Switching to PRODUCTION mode (real publish)..."
24+
25+
# CI/CD workflow
26+
sed -i '' 's/melos publish --dry-run/melos publish --no-dry-run/g' .github/workflows/ci-cd.yml
27+
sed -i '' 's/🧪 Test package publication (DRY-RUN MODE)/📦 Publish to pub.dev/g' .github/workflows/ci-cd.yml
28+
29+
# Manual release workflow
30+
sed -i '' 's/melos publish --dry-run/melos publish --no-dry-run/g' .github/workflows/manual-release.yml
31+
32+
echo "✅ Switched to PRODUCTION mode"
33+
echo "⚠️ Packages WILL BE PUBLISHED to pub.dev"
34+
;;
35+
36+
"status")
37+
echo "📊 Current publish mode status:"
38+
echo ""
39+
40+
if grep -q "melos publish --dry-run" .github/workflows/ci-cd.yml; then
41+
echo "🧪 Currently in TEST mode (dry-run)"
42+
echo " - No packages will be published"
43+
echo " - Run: ./scripts/toggle-publish-mode.sh production"
44+
else
45+
echo "🚀 Currently in PRODUCTION mode"
46+
echo " - Packages WILL BE PUBLISHED to pub.dev"
47+
echo " - Run: ./scripts/toggle-publish-mode.sh test"
48+
fi
49+
;;
50+
51+
*)
52+
echo "Usage: $0 [test|production|status]"
53+
echo ""
54+
echo "Commands:"
55+
echo " test - Switch to test mode (dry-run, no publishing)"
56+
echo " production - Switch to production mode (real publishing)"
57+
echo " status - Show current mode"
58+
echo ""
59+
echo "Examples:"
60+
echo " $0 test # Switch to test mode"
61+
echo " $0 production # Switch to production mode"
62+
echo " $0 status # Check current mode"
63+
exit 1
64+
;;
65+
esac

0 commit comments

Comments
 (0)