|
| 1 | +# Publishing to GitHub Package Registry |
| 2 | + |
| 3 | +This guide explains how to publish the `ngx-angular-query-builder` library to GitHub Package Registry. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +1. **GitHub Repository**: Ensure your code is pushed to a GitHub repository |
| 8 | +2. **GitHub Personal Access Token**: Create a token with `write:packages` scope |
| 9 | +3. **Updated Configuration**: Make sure all configuration files are properly set up |
| 10 | + |
| 11 | +## Local Publishing (Manual) |
| 12 | + |
| 13 | +If you want to publish manually: |
| 14 | + |
| 15 | +1. **Build the library:** |
| 16 | + ```bash |
| 17 | + npm run build-package |
| 18 | + ``` |
| 19 | + |
| 20 | +2. **Navigate to the dist folder:** |
| 21 | + ```bash |
| 22 | + cd dist/ngx-angular-query-builder |
| 23 | + ``` |
| 24 | + |
| 25 | +3. **Login to GitHub Package Registry:** |
| 26 | + ```bash |
| 27 | + npm login --registry=https://npm.pkg.github.com |
| 28 | + ``` |
| 29 | + - Username: Your GitHub username (lowercase) |
| 30 | + - Password: Your GitHub Personal Access Token (classic) |
| 31 | + |
| 32 | +4. **Publish:** |
| 33 | + ```bash |
| 34 | + npm publish |
| 35 | + ``` |
| 36 | + |
| 37 | +## Installation for Users |
| 38 | + |
| 39 | +Once published, users can install your package by: |
| 40 | + |
| 41 | +1. **Creating `.npmrc` in their project:** |
| 42 | + ``` |
| 43 | + @YOUR_GITHUB_USERNAME:registry=https://npm.pkg.github.com |
| 44 | + //npm.pkg.github.com/:_authToken=THEIR_GITHUB_TOKEN |
| 45 | + ``` |
| 46 | + |
| 47 | +2. **Installing the package:** |
| 48 | + ```bash |
| 49 | + npm install @YOUR_GITHUB_USERNAME/ngx-angular-query-builder |
| 50 | + ``` |
| 51 | + |
| 52 | +## Troubleshooting |
| 53 | + |
| 54 | +### Common Issues: |
| 55 | + |
| 56 | +1. **Authentication Error:** |
| 57 | + - Ensure you are using a GitHub classic access token with `write:packages` scope |
| 58 | + - Verify the token is not expired |
| 59 | + |
| 60 | +2. **Package Not Found:** |
| 61 | + - Check the package name includes the @csfloat scope |
| 62 | + - Ensure the repository is public and you have access to it |
| 63 | + |
| 64 | +4. **Workflow Failures:** |
| 65 | + - Check the Actions tab for detailed error logs |
| 66 | + - Ensure GITHUB_TOKEN has sufficient permissions |
0 commit comments