@lexoyo/npm-deploy-trusted-publisher
v1.0.9
Published
A minimal TypeScript package ready to publish on npm
Readme
@silexlabs/my-package
A minimal TypeScript package ready to publish on npm with OIDC authentication.
Features
- TypeScript support with declaration files
- Automated publishing via GitHub Actions
- OIDC authentication (no npm tokens needed)
- Automatic npm tag management (latest/next)
- Provenance attestation enabled
Prerequisites
Before publishing, configure npm Trusted Publisher:
- Go to npmjs.com and log in
- Navigate to your package (create it first if needed, or it will be created on first publish)
- Go to Settings > Publishing access
- Click "Add provider" under "Trusted Publishers"
- Fill in:
- Provider: GitHub Actions
- Repository:
your-username/your-repo - Workflow:
publish.yml - Environment: (leave empty)
Installation
npm installBuild
npm run buildTesting the Publication Workflow
1. Initialize Git Repository
git init
git add .
git commit -m "Initial commit"2. Create GitHub Repository
Create a new repository on GitHub (must match the one configured in npm Trusted Publisher).
git remote add origin https://github.com/your-username/your-repo.git
git push -u origin main3. Create and Push a Tag
For a stable release (will be tagged as latest on npm):
git tag v1.0.0
git push origin v1.0.0For a pre-release (will be tagged as next on npm):
git tag v1.0.0-beta.1
git push origin v1.0.0-beta.14. Monitor the Workflow
- Go to your GitHub repository
- Click on "Actions" tab
- Watch the "Publish to npm" workflow run
- Once completed, check your package on npmjs.com
Version Tag Management
The workflow automatically determines the npm dist-tag:
- latest: For stable versions (e.g.,
v1.0.0,v2.1.3) - next: For pre-releases containing:
alpha,beta,rc, ornext(e.g.,v1.0.0-beta.1,v2.0.0-rc.1)
Usage (After Publishing)
import { greet } from '@silexlabs/my-package';
console.log(greet('World')); // "Hello, World!"Development
- Make your changes in
src/ - Build:
npm run build - Test locally
- Commit and push
- Create a tag and push to trigger publication
License
MIT
