Publishing to CPAN
This document describes how to publish the JSON::Structure Perl SDK to CPAN.
Prerequisites
1. PAUSE Account
Request an account at https://pause.perl.org/pause/query?ACTION=request_id
PAUSE (Perl Authors Upload Server) is the gateway to CPAN. You'll need an account to upload modules.
2. GitHub Secrets
Configure these secrets in your repository settings (Settings → Secrets and variables → Actions):
PAUSE_USERNAME: Your PAUSE usernamePAUSE_PASSWORD: Your PAUSE password
3. GitHub Environment
Create a protected environment named cpan for the secrets:
- Go to Settings → Environments
- Create a new environment named
cpan - Optionally add required reviewers for additional security
- The secrets will be scoped to this environment
Automated Release Process
The CI workflow automatically publishes to CPAN when you push a version tag.
Creating a Release
- Ensure all tests pass on the
perl-sdkbranch - Update the version number in modules if needed
- Create and push a version tag:
git tag v0.02
git push origin v0.02
What Happens Automatically
The CI workflow will:
- ✅ Run all tests across multiple Perl versions (5.20, 5.26, 5.32, 5.38)
- ✅ Run tests on multiple platforms (Ubuntu, macOS, Windows)
- ✅ Run Perl::Critic linting
- ✅ Build the distribution tarball
- ✅ Update version numbers in all
.pmfiles from the tag - ✅ Upload to CPAN via PAUSE
Tag Format
Tags must follow the pattern v[0-9]+.[0-9]+.[0-9]+:
v0.01- Initial releasev0.02- Patch releasev1.0.0- Major release
Manual Upload
You can also upload manually if needed:
Building the Distribution
cd perl
perl Makefile.PL
make
make manifest
make dist
This creates JSON-Structure-0.01.tar.gz.
Uploading to CPAN
Install the uploader:
cpanm CPAN::Uploader
Upload:
cpan-upload -u YOUR_PAUSE_USERNAME JSON-Structure-0.01.tar.gz
You'll be prompted for your PAUSE password.
Using a .pause File
For convenience, create ~/.pause:
user YOUR_PAUSE_USERNAME
password YOUR_PAUSE_PASSWORD
Then simply:
cpan-upload JSON-Structure-0.01.tar.gz
Verification
After uploading:
- Check https://pause.perl.org for indexing status
- Wait 1-2 hours for CPAN mirrors to sync
- Verify on https://metacpan.org/pod/JSON::Structure
- Test installation:
cpanm JSON::Structure
Troubleshooting
Upload Rejected
- Ensure your PAUSE account has permissions for the
JSON::Structurenamespace - Check that the version number is higher than any previously uploaded version
- Verify the distribution passes
make test
Indexing Issues
- Check the PAUSE indexer logs in your PAUSE account
- Ensure all modules have proper
$VERSIONdeclarations - Verify the package names match the file paths
First-Time Upload
For the first upload of a new namespace:
- PAUSE will send you an email to confirm namespace ownership
- Respond to claim the namespace
- Subsequent uploads will be automatic
Version Management
The version is defined in each module:
our $VERSION = '0.01';
The CI workflow automatically updates this from the git tag during releases. For manual releases, update the version in:
lib/JSON/Structure.pmlib/JSON/Structure/SchemaValidator.pmlib/JSON/Structure/InstanceValidator.pmlib/JSON/Structure/Types.pmlib/JSON/Structure/ErrorCodes.pmlib/JSON/Structure/JsonSourceLocator.pm