This directory contains utility scripts for development and publishing workflows for the Flutter Wallet Card project.
Package publishing and release management script.
Purpose: Handles package validation, versioning, and publishing to pub.dev.
Features:
- Comprehensive package validation
- Automated testing and quality checks
- Version management and git tagging
- Pub.dev publishing with safety checks
- Full release workflow automation
- Flutter SDK (3.13.0 or later)
- Dart SDK (included with Flutter)
- Git (for version control)
- OSV Scanner (for security scanning)
- pana (for package analysis)
# Install Dart tools (optional)
dart pub global activate pana# Check package status
./scripts/publish-package.sh info
# Validate package
./scripts/publish-package.sh validate
# Full release
./scripts/publish-package.sh release --version 1.0.0| Command | Description | Use Case |
|---|---|---|
info |
Show package information | Status check |
validate |
Validate package structure | Pre-publish check |
test |
Run all tests and checks | Quality assurance |
dry-run |
Test publish without uploading | Safety check |
version |
Update version and create tag | Version management |
publish |
Publish to pub.dev | Package release |
release |
Full release workflow | Complete release |
Package Information:
./scripts/publish-package.sh info
# Shows: name, version, git status, auth statusPre-publish Validation:
# Comprehensive validation
./scripts/publish-package.sh validate
# Test publish (no upload)
./scripts/publish-package.sh dry-runVersion Management:
# Update version and create git tag
./scripts/publish-package.sh version --version 1.2.0
# This will:
# 1. Update pubspec.yaml
# 2. Update CHANGELOG.md
# 3. Commit changes
# 4. Create git tag v1.2.0Publishing:
# Publish current version
./scripts/publish-package.sh publish
# Full release (recommended)
./scripts/publish-package.sh release --version 1.2.0The release command performs:
- ✅ Dependency checks
- ✅ Git status validation
- ✅ Code formatting check
- ✅ Static analysis
- ✅ Unit tests
- ✅ Package structure validation
- ✅ Dry-run publish
- ✅ Pub.dev authentication check
- 🔄 Version update
- 🔄 Git tag creation
- 🚀 Package publishing
# Authenticate with pub.dev
dart pub token add https://pub.dev
# Verify authentication
ls ~/.pub-cache/credentials.json# Set git user (if not already set)
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"Edit publish-package.sh to customize:
# Add custom validation
validate_custom() {
# Your custom validation logic
echo "Running custom validation..."
}
# Modify version update logic
update_version() {
# Your custom version update logic
}Authentication fails:
# Re-authenticate
dart pub token add https://pub.dev
# Check credentials
cat ~/.pub-cache/credentials.jsonTests fail:
# Run tests manually
flutter test
# Check specific test
flutter test test/specific_test.dart
# Run with coverage
flutter test --coverageVersion conflicts:
# Check current version
grep '^version:' pubspec.yaml
# Check pub.dev for existing versions
curl -s https://pub.dev/api/packages/flutter_wallet_card | jq '.versions'Git issues:
# Check git status
git status
# Commit pending changes
git add .
git commit -m "Prepare for release"
# Check remote
git remote -vRun scripts with debug output:
# Enable bash debug mode
bash -x ./scripts/publish-package.sh validate
# Or add debug flag to script
set -x # Add this line to script for debuggingScripts create temporary files during execution:
# Check temporary files
ls /tmp/flutter_wallet_card_*
# Pub publish logs
cat ~/.pub-cache/log/pub_log.txtThese scripts are designed to work with the GitHub Actions workflows:
ci.yml- Uses validation logic frompublish-package.shpublish.yml- Uses publishing logic frompublish-package.shrelease.yml- Uses publishing logic for releases
Test workflows locally before pushing:
# Test publishing workflow
./scripts/publish-package.sh dry-run
# Test full release workflow
./scripts/publish-package.sh validate-
Before making changes:
./scripts/publish-package.sh info ./scripts/publish-package.sh validate
-
Before committing:
./scripts/publish-package.sh test -
Before releasing:
./scripts/publish-package.sh dry-run
-
Prepare release:
- Update documentation
- Write changelog entries
- Test thoroughly
-
Create release:
./scripts/publish-package.sh release --version X.Y.Z
-
Post-release:
- Verify package on pub.dev
- Update GitHub release notes
- Never commit credentials to version control
- Use environment variables for sensitive data
- Validate inputs before processing
- Use dry-run before actual publishing
- Review changes before releasing
When modifying scripts:
- Test thoroughly on different environments
- Update documentation for any changes
- Follow existing patterns and conventions
- Add error handling for edge cases
- Include help text for new options
- Use
set -efor error handling - Provide colored output for better UX
- Include comprehensive help text
- Validate inputs and dependencies
- Use temporary files safely
- Clean up on exit
For issues with scripts:
- Check this documentation
- Review script help:
./script-name.sh help - Check GitHub Issues
- Create new issue with:
- Script name and command used
- Full error output
- Environment details (OS, Flutter version, etc.)
Last Updated: This documentation is maintained alongside the scripts and updated with each release.