This package is published to both NPM and GitHub Packages. This document explains how to set up and use GitHub Packages for this repository.
GitHub Packages is a package hosting service integrated with GitHub. It allows you to publish npm packages directly to your GitHub repository, making them available to anyone with access to your repository.
- Package Name:
@ibrahimcesar/react-lite-youtube-embed - Registry:
https://npm.pkg.github.com - Scope:
@ibrahimcesar
GitHub Packages publishing is fully automated through GitHub Actions. When you create a release, the package is automatically published to both NPM and GitHub Packages.
- Go to Actions tab in your repository
- Select Automated Release workflow
- Click Run workflow
- Select version bump type (patch/minor/major)
- Choose if it's a beta release
- Click Run workflow
The workflow will:
- Run tests and build the project
- Bump the version in package.json
- Generate changelog from commits
- Create a git tag
- Create a GitHub release
- Publish to NPM
- Publish to GitHub Packages
- Create a new release on GitHub
- The
release.ymlworkflow will automatically trigger - Package will be published to both NPM and GitHub Packages
If you need to publish manually:
-
Create
.npmrcfile (from.npmrc.example):cp .npmrc.example .npmrc
-
Get a GitHub Personal Access Token:
- Go to https://github.com/settings/tokens/new
- Give it a descriptive name (e.g., "NPM Package Publishing")
- Select scopes:
write:packages,read:packages - Generate and copy the token
-
Update
.npmrcwith your token:@ibrahimcesar:registry=https://npm.pkg.github.com //npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN -
Build and Publish:
npm run build npm publish
Create or update .npmrc in your project root:
@ibrahimcesar:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
Then install normally:
npm install @ibrahimcesar/react-lite-youtube-embednpm install @ibrahimcesar/react-lite-youtube-embed --registry=https://npm.pkg.github.comConfigure npm globally (affects all projects):
npm config set @ibrahimcesar:registry https://npm.pkg.github.com
npm config set //npm.pkg.github.com/:_authToken YOUR_GITHUB_TOKENGitHub requires authentication to install packages from GitHub Packages:
- Go to https://github.com/settings/tokens/new
- Give it a descriptive name (e.g., "Read GitHub Packages")
- Select scope:
read:packages - Generate and copy the token
- Use it in your
.npmrcfile
Once installed, usage is identical regardless of whether you installed from NPM or GitHub Packages:
import LiteYouTubeEmbed from '@ibrahimcesar/react-lite-youtube-embed';
import '@ibrahimcesar/react-lite-youtube-embed/dist/LiteYouTubeEmbed.css';
function App() {
return (
<LiteYouTubeEmbed
id="dQw4w9WgXcQ"
title="YouTube Video"
/>
);
}You can view all published versions at:
- GitHub Packages: https://github.com/ibrahimcesar/react-lite-youtube-embed/packages
- NPM Registry: https://www.npmjs.com/package/react-lite-youtube-embed
If you see 401 Unauthorized or 403 Forbidden:
- Verify your token has the correct permissions (
read:packagesorwrite:packages) - Ensure your token hasn't expired
- Check that your
.npmrcfile is correctly formatted - Verify the scope matches:
@ibrahimcesar
If you see 404 Not Found:
- Ensure you're using the scoped package name:
@ibrahimcesar/react-lite-youtube-embed - Verify the registry URL in your
.npmrc:https://npm.pkg.github.com - Check that the package has been published successfully
If you see unexpected versions:
- Clear npm cache:
npm cache clean --force - Delete
node_modulesandpackage-lock.json - Run
npm installagain
- Never commit
.npmrcwith tokens - It's already in.gitignore - Use environment variables in CI/CD - GitHub Actions uses
GITHUB_TOKENautomatically - Rotate tokens regularly - Delete old tokens when no longer needed
- Use minimal permissions - Only grant
read:packagesfor installing,write:packagesfor publishing - Use organization tokens - For team projects, use organization-level tokens
- Integrated with GitHub - Package versions linked to releases and commits
- Access Control - Use GitHub's permission system
- Free for public repositories - Unlimited bandwidth and storage
- Version History - View all versions in one place
- Dependency Graph - See which projects depend on this package
If you have questions or issues with GitHub Packages publishing:
- Check this documentation first
- Review GitHub Packages documentation
- Open an issue on this repository
- Contact the maintainer
Note: This package is also available on the public NPM registry as react-lite-youtube-embed (without the @ibrahimcesar scope). You can use either registry based on your preference.