This document describes how to publish new versions of the @paytabs/react-native-paytabs package to npm.
- NPM Account: Ensure you have an npm account with publish access to
@paytabs/react-native-paytabs - NPM Login: Run
npm loginbefore publishing - Git Access: Ensure you have push access to the repository
- Clean Working Directory: Commit or stash all changes before publishing
The repository includes a convenient shell script for version bumping and publishing:
# Bump patch version (e.g., 2.6.9 -> 2.6.10)
./scripts/publish.sh patch
# Bump minor version (e.g., 2.6.9 -> 2.7.0)
./scripts/publish.sh minor
# Bump major version (e.g., 2.6.9 -> 3.0.0)
./scripts/publish.sh majorWhat the script does:
- Validates that you're on the master/main branch
- Checks for a clean working directory
- Pulls the latest changes
- Installs dependencies
- Runs linter and tests
- Builds the library
- Bumps the version in
package.json - Commits the version bump
- Creates a git tag
- Pushes to GitHub
- Publishes to npm
Alternatively, you can use the built-in release-it configuration:
yarn releaseThis will:
- Prompt you for the version bump type
- Generate a changelog
- Create a git tag
- Push to GitHub
- Publish to npm
- Create a GitHub release
The repository is configured with Codemagic CI/CD for automated builds and publishing.
-
Add the repository to Codemagic
- Go to Codemagic
- Add the repository
-
Configure Environment Variables
- In Codemagic, create an environment group called
npm_credentials - Add the following variable:
NPM_TOKEN: Your npm authentication token (get it from npmjs.com → Access Tokens)
- In Codemagic, create an environment group called
-
Configure Notifications
- Update the email recipients in
codemagic.yamlif needed
- Update the email recipients in
Triggers: Push to master/main or tags matching v*
Actions:
- Installs dependencies
- Runs linter
- Runs tests
- Builds the library
- Builds Android library
- Validates iOS Podspec
Triggers: Git tags matching v*
Actions:
- Installs dependencies
- Builds the library
- Publishes to npm with public access
To trigger:
# Create and push a version tag
git tag v2.6.10
git push origin v2.6.10Triggers: Pull requests to any branch
Actions:
- Builds Android library
- Validates the build process
Triggers: Pull requests to any branch
Actions:
- Builds iOS example app
- Validates CocoaPods integration
Follow Semantic Versioning:
- Patch (2.6.9 → 2.6.10): Bug fixes, minor changes
- Minor (2.6.9 → 2.7.0): New features, backward compatible
- Major (2.6.9 → 3.0.0): Breaking changes
- All tests pass locally
- Linter shows no errors
- CHANGELOG is updated (if using manual process)
- Documentation is up to date
- Example app works correctly
- iOS and Android builds succeed
- You're on the master/main branch
- Working directory is clean
npm loginContact the package owner to add you as a maintainer:
npm owner add <username> @paytabs/react-native-paytabs# Delete the local tag
git tag -d v2.6.10
# Delete the remote tag
git push origin :refs/tags/v2.6.10# Clean and rebuild
yarn clean
yarn install
yarn prepareAfter publishing:
- Verify the package on npm: https://www.npmjs.com/package/@paytabs/react-native-paytabs
- Check the GitHub release: https://github.com/paytabscom/react-native-paytabs-library/releases
- Test installation in a fresh project:
npm install @paytabs/react-native-paytabs@latest
- Update any dependent projects
- Announce the release (if major version)
For issues with publishing:
- Check the npm documentation
- Contact muhammad.alkady@paytabs.com
- Review Codemagic build logs