|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This document explains how to release new versions of `@glideapps/ts-necessities` to NPM. |
| 4 | + |
| 5 | +## GitHub Actions Workflows |
| 6 | + |
| 7 | +The repository uses two main GitHub Actions workflows: |
| 8 | + |
| 9 | +1. **CI Workflow** (`ci.yml`) |
| 10 | + - Runs on every push to `main` and on pull requests |
| 11 | + - Runs on Node.js 20.x and 22.x |
| 12 | + - Performs build, lint, and test operations |
| 13 | + - Verifies dual module compatibility (CJS and ESM) |
| 14 | + |
| 15 | +2. **Publish Workflow** (`publish.yml`) |
| 16 | + - Triggers automatically when a GitHub release is created |
| 17 | + - Builds, tests, and publishes the package to NPM |
| 18 | + - Verifies that the package version matches the GitHub release tag |
| 19 | + - Uses the `NPM_TOKEN` secret for authentication |
| 20 | + |
| 21 | +## Making a Release |
| 22 | + |
| 23 | +### Prerequisites |
| 24 | + |
| 25 | +- Ensure you have write access to the GitHub repository |
| 26 | +- Make sure the `NPM_TOKEN` secret is set up in the repository settings |
| 27 | + - Go to Settings → Secrets and variables → Actions |
| 28 | + - The token should have permission to publish to the `@glideapps` organization |
| 29 | + |
| 30 | +### Steps to Release |
| 31 | + |
| 32 | +1. **Update Package Version** |
| 33 | + - Update the `version` field in `package.json` |
| 34 | + - Commit and push the change to `main` |
| 35 | + |
| 36 | +2. **Create a GitHub Release** |
| 37 | + - Go to the repository on GitHub |
| 38 | + - Navigate to Releases → "Create a new release" |
| 39 | + - Create a new tag (e.g., `v2.4.0` - must match the version in `package.json`) |
| 40 | + - Add a title and description for the release |
| 41 | + - Click "Publish release" |
| 42 | + |
| 43 | +3. **Automatic Publishing** |
| 44 | + - The `publish.yml` workflow will automatically trigger |
| 45 | + - It will verify the version matches the tag |
| 46 | + - If tests pass, it will publish to NPM |
| 47 | + |
| 48 | +4. **Verify the Release** |
| 49 | + - Check the Actions tab to ensure the workflow completed successfully |
| 50 | + - Verify the package is available on NPM with the new version |
| 51 | + |
| 52 | +## Dual Module Format |
| 53 | + |
| 54 | +The package is published in both CommonJS and ESM formats: |
| 55 | + |
| 56 | +- `dist/index.js` - CommonJS module |
| 57 | +- `dist/index.mjs` - ESM module |
| 58 | +- `dist/index.d.ts` - TypeScript declarations |
| 59 | + |
| 60 | +The `package.json` is configured with: |
| 61 | +```json |
| 62 | +{ |
| 63 | + "main": "dist/index.js", |
| 64 | + "module": "dist/index.mjs", |
| 65 | + "types": "dist/index.d.ts", |
| 66 | + "exports": { |
| 67 | + ".": { |
| 68 | + "types": "./dist/index.d.ts", |
| 69 | + "import": "./dist/index.mjs", |
| 70 | + "require": "./dist/index.js", |
| 71 | + "default": "./dist/index.js" |
| 72 | + } |
| 73 | + } |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +This configuration ensures that: |
| 78 | +- Node.js projects using CommonJS will use `dist/index.js` |
| 79 | +- Projects using ESM will use `dist/index.mjs` |
| 80 | +- TypeScript tools will find the type definitions |
| 81 | + |
| 82 | +## Troubleshooting |
| 83 | + |
| 84 | +- **Workflow Failures**: Check the GitHub Actions logs for detailed error messages |
| 85 | +- **Version Mismatch**: Ensure the tag name (without the 'v' prefix) matches the version in `package.json` |
| 86 | +- **Publishing Issues**: Verify the `NPM_TOKEN` is valid and has publish permissions |
| 87 | +- **Module Format Issues**: Use the dual module compatibility test to verify both formats work correctly |
| 88 | + |
| 89 | +## NPM Package Page |
| 90 | + |
| 91 | +The package is published at: https://www.npmjs.com/package/@glideapps/ts-necessities |
0 commit comments